- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2014 11:03 PM
onchange event not working for ui_date field type in UI Page but it works for ui_date_time field type.
Any suggestions?
Solved! Go to Solution.
- Labels:
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2014 01:10 PM
Hi, Aman. The ui_date UI Macro does not add the onchange attribute to the input element. If you check the macro you'll see this:
<input id="${jvar_name}" type="text" name="${jvar_name}" value="${jvar_value}" />
It's easy enough to add it like this:
<input id="${jvar_name}" type="text" name="${jvar_name}" value="${jvar_value}" onchange="${jvar_onchange}" />
But rather than modify the delivered version you should create a copy of ui_date (called ui_date_custom ??) and change that macro to include the onchange attribute.
Then in your ui page call your custom ui macro like this:
<g:inline template="ui_date_custom" name="start_date_row1" id="start_date_row1" value = "" onchange="datePicked(this.value,'oncall_end_date_row1');"/>
Hope that helps.
- Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2014 04:02 AM
Hi,
Please post your code and UI Page which you are using.
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2014 10:02 AM
Hi,
Below is the line of code that i have in the UI Page
<g:ui_date name="start_date_row1" id="start_date_row1" value = "" onchange="datePicked(this.value,'oncall_end_date_row1');"/>
When i look at the source of resulting html, i see
<label style="display:none" for="start_date_row1">start_date_row1</label>
<input id="start_date_row1" value="" name="start_date_row1" type="text">
<span style="margin: 2px"></span>
<a onclick="new GwtDateTimePicker('start_date_row1', 'yyyy-MM-dd', false);"><img id="anchorstart_date_row1x" title="Choose date..." name="anchorstart_date_row1x" class="button" src="images/small_calendar.gifx" border="0" height="16" width="16"></a>
I dont even see the onchange event in the html. If i change the widget type to ui_date_time , i do see the onchange code
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2014 01:10 PM
Hi, Aman. The ui_date UI Macro does not add the onchange attribute to the input element. If you check the macro you'll see this:
<input id="${jvar_name}" type="text" name="${jvar_name}" value="${jvar_value}" />
It's easy enough to add it like this:
<input id="${jvar_name}" type="text" name="${jvar_name}" value="${jvar_value}" onchange="${jvar_onchange}" />
But rather than modify the delivered version you should create a copy of ui_date (called ui_date_custom ??) and change that macro to include the onchange attribute.
Then in your ui page call your custom ui macro like this:
<g:inline template="ui_date_custom" name="start_date_row1" id="start_date_row1" value = "" onchange="datePicked(this.value,'oncall_end_date_row1');"/>
Hope that helps.
- Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2014 02:01 PM
Thanks Steve.
This works perfectly.