Last active
May 11, 2021 13:10
Revisions
-
anil826 revised this gist
May 11, 2021 . 1 changed file with 22 additions and 12 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,13 +1,23 @@ $(".finish").on("click", function (ev) { ev.stopImmediatePropagation(); let isValid = true; //Loop on all formyoula fields Object.keys(formyoula.form_fields).forEach(function(component_id) { //Regex for element component id if (/^[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}$/.test(component_id)) { //Get component let component = formyoula.form_fields[component_id]; //Check if component attribute is available and value is empty if ( component.attributes && component.attributes.required && _.isEmpty( component.attributes.value ) ) { isValid = false; } } }); if ( !isValid ) { //Show the custome Error message window.formyoula.show_alert({message: 'Please check the requried Field', title: 'Required Field Error'}); return false; } //Submit the form $(".finish").off("click").click(); }); -
anil826 created this gist
May 11, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ //Loop on all formyoula fields Object.keys(formyoula.form_fields).forEach(function(component_id) { //Regex for element component id if (/^[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}$/.test(component_id)) { //Get component let component = formyoula.form_fields[component_id]; //Check if component attribute is available and value is empty if ( component.attributes && component.attributes.required && _.isEmpty( component.attributes.value ) ) { //Show the custome Error message window.formyoula.show_alert({message: 'Please check the requried Field', title: 'Required Field Error'}) } } });