Prevent Submitting the form if Multi row variable set is empty
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2022 08:44 PM
Hi,
I am populating multi row variable set based on requested for user info and want to prevent submitting the form whenever MRVS is empty. Tried mrvrs == '' like highlighted below in red but its not working.
function onSubmit() {
var today = new Date();
var mrvs = g_form.getValue('vta_training_details'); // internal name of your MRVS
alert(mrvs);
var obj = JSON.parse(mrvs);
for (var i = 0; i < obj.length; i++) {
var startDTe = obj[i].course_completed_date; // name of the MRVS variable
//alert(startDTe);
var startDateNum = getDateFromFormat(startDTe, g_user_date_format);
var coursedate = today - startDateNum;
//alert(coursedate);
var dayDifference = coursedate / (1000 * 60 * 60 * 24);
alert(dayDifference);
if ((dayDifference > 365) || (mrvs == '') || (mrvs == null)) {
g_form.addErrorMessage("Course Completed Date should not be more than 365 days");
return false;
}
}
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2022 11:20 AM
I tried above solution, its not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2024 07:39 AM
thank you so Much