UI Page Jelly - Mandatory and Required Attributes doesn't work as expected!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-30-2017 11:46 PM
Hi All,
I woud like to have empty check for my fields in the form using mandatory="true" in the jelly scripting on a UI page, without going in for a customized check on the field.
But the mandatory="true" or required="true" doesn't seem to work on Jelly scripting in UI page. Can anyone please help?
Thanks & Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-01-2017 03:24 AM
Hi Rajalaxmi,
Could you please try this instead in the client script:
if(gel('ID').value==''){//input the id of the field
alert("fieldname is mandatory is mandatory.");
post me your feedback
Please Hit ✅Correct, âÂ��Helpful, or ��Like depending on the impact of the response
Have a lovely day ahead
Regards,
Divya Mishra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-01-2017 04:03 AM
Hi Divya,
Yes, I have been using this on my ui pages. But I was wondering why the mandatory="true" is not working.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-01-2017 04:08 AM
No some of the javascript things are obsolete.
just an additional thing if you want to show a field mandatory just add and additional span with value * and color red
post me your feedback
Please Hit ✅Correct, âÂ��Helpful, or ��Like depending on the impact of the response
Have a lovely day ahead
Regards,
Divya Mishra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-01-2017 06:42 AM
HI Rajalakshmi,
It reads like what you've done is made a custom UI page and are doing something like the following to generate a checkbox that is required.
<g:ui_checkbox mandatory="true" name="my_mandatory_checkbox" >My Mandatory Checkbox</g:ui_checkbox>
Doing this won't make the checkbox element required because the ui_checkbox macro isn't built to accept that attribute. However, this doesn't mean you need to create a new one. If you need this to be set as required you can simply put something similar to this in the client script section of the UI Page record:
gel('ni.my_mandatory_checkbox').required = true
Notice the "ni." prefix. The reason for this is because the ui_checkbox macro when rendered actually creates two checkbox inputs, one being hidden which is the one that developers would be using to perform actions on; ie gel('my_mandatory_checkbox').value to get the value.
Be aware that this won't put a red asterisk to show that it is mandatory. But it will stop the form from being submitted if not filled in.