0

In my portlet I have one form where I am showing dates through following code

JSP:

<aui:input type="text" name="createdDate" size="10" value="" id="createdDate" label="" />
      <div class="calendar-icon" id="imageDiv">
 <span class="aui-icon aui-icon-calendar"></span>
 </div>

Script in JSP

renderCalendar('#imageDiv','#<portlet:namespace/>createdDate','#calendarDiv');
function renderCalendar(imageDiv,inputDisplay,calendarDiv)  {
  AUI().ready('aui-calendar', function(A) {
    var inputField1 = A.one(imageDiv); 
    var inputField2 = A.one(inputDisplay);

    var calendar1 = new A.Calendar({    
        dates: [ new Date() ],   
        dateFormat: '%d/%m/%Y',     
        selectMultipleDates: false,        
        after: {                        
            datesChange: function(event) {         
                        var formatted = event.target.getFormattedSelectedDates();       
                        inputField2.val(formatted); 
                        calendar1.toggle(); // hide after a date was selected        
                    }        
                }
    }).render(calendarDiv);   

    var boundingBoxCal1 = calendar1.get('boundingBox');  
    boundingBoxCal1.setX(inputField1.getX());         
    boundingBoxCal1.setY(inputField1.getY() + 25);      
    calendar1.hide(); 
    inputField1.on('click', function() { calendar1.toggle(); });        
});
}

It is showing date on page but the problem is with layout Date text field and calender icon both not coming in same line.Please help me out enter image description here

mitpatoliya
  • 2,037
  • 12
  • 23

2 Answers2

0

use <span> instead of <div>. <div> opens a new block while <span> will remain in the same line

Olaf Kock
  • 46,930
  • 8
  • 59
  • 90
0

Strange that <span> didn't fix your problem. Try floating your <div> to the left, as in,

<div class="calendar-icon" id="imageDiv" style="float: left;">
Nani
  • 214
  • 4
  • 13