- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2023 02:15 AM
In my form I have a date field
when the user filled the date field
I need to compare with the current date in client scripts
filled date should be greater than current date
can anyone help please.....?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2023 02:20 AM - edited 08-02-2023 02:30 AM
Hi @Phani Pasupulet,
I would suggest to use UI policy instead of Client scripts.
Conditions:
Date_field AT OR BEFORE Today
Execute of true:
function onCondition() {
g_form.clearValue("date_field");
g_form.showFieldMsg("date_field", "Date should be greater than today" , "error");
}
Execute of false:
function onCondition() {
g_form.hideFieldMsg("date_field");
}
// added date_field in hidefieldMsg() fucntion
If my response helps to solve your issue. Kindly mark it as helpful & correct. It will be helpful for future readers.
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2023 02:21 AM - edited 08-02-2023 02:22 AM
You can use a simple ui policy to do so
Instead of current minute you can also use today id that works better for you.
Then you can use the script or ui policy action to add alert or change fields as needed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2023 02:20 AM - edited 08-02-2023 02:30 AM
Hi @Phani Pasupulet,
I would suggest to use UI policy instead of Client scripts.
Conditions:
Date_field AT OR BEFORE Today
Execute of true:
function onCondition() {
g_form.clearValue("date_field");
g_form.showFieldMsg("date_field", "Date should be greater than today" , "error");
}
Execute of false:
function onCondition() {
g_form.hideFieldMsg("date_field");
}
// added date_field in hidefieldMsg() fucntion
If my response helps to solve your issue. Kindly mark it as helpful & correct. It will be helpful for future readers.
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2023 06:47 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2023 10:28 AM
Hi @Deepak89,
You can use return false; to avoid form submission at any client side scripts.
If my response helps you resolve your issue. Kindly mark it as helpful & correct. It will be helpful to future readers! 👍🏻
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2023 11:13 AM
Hello @Sagar Pagar ,
correct we can add return false at client side but above at True condition of UI Policy how can i restrict user to submit form in same script.
Execute of true:
function onCondition() {
g_form.clearValue("date_field");
g_form.showFieldMsg("date_field", "Date should be greater than today" , "error");
}