- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-24-2019 04:12 AM
hi experts,
I set "Date" max length is 4, but in form layout it can input 15 ,why?
Solved! Go to Solution.
- Labels:
-
Instance Configuration
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-24-2019 04:55 AM
That's not possible. You can't restrict the user to add only 4 numbers. You could use the workaround Anurag and I mentioned, giving an error, maybe even do g_form.clearValue('u_date') to empty the field.
If really restricting the input, you can look at DOM manipulation. Though that's BAD PRACTICE. So not adviced.
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
---
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-24-2019 04:51 AM
this can pop up an error message and still can input data when its length>4 , but I want make it not edit when it length>4, how to achieve?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-24-2019 04:52 AM
you can set g_form.setReadOnly('field name',true);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-24-2019 04:53 AM
eg:
if(g_form.getValue('u_date')> 4){
g_form.setReadOnly('u_date',true);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-24-2019 05:01 AM
var date = g_form.getValue('u_date');
if(date.toString().length >4) {
g_form.setReadOnly('u_date',true);
}
it didn't work
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-24-2019 05:04 AM
The code Harshvardhan provided is for making the variable readonly. While you are after restricting the input.
Again: not possible. Have a look at the workarounds that give an error message + maybe add g_form.clearValue('u_date');
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
---