Woman In Tech: NAVIGATING THE DIGITAL WORLD

seeker, learner, educator and paying it forward… in short – Jigyaasu

Validation issue with #NintexForm for #Office365

Posted by

·

, , , , , , , , , ,

Those following this post on Nintex connect, know that I have been struggling to set client validation on controls in the form that our end-users have to submit which are required fields. Issue with description can be found in this NintexConnect post.
Text/ field validation with button click in #nintexforms for #office365

Support team was quite helpful as always but this time, it was a little more difficult to troubleshoot to get this validation to work.

I used several references and they are listed at the end of the post. But long story short,

  • Validation rules with Regex did NOT help me with anything or the desired effect that my client was  asking for.
  • I had to setup a On-Click event in on of the buttons that forward the screen to the next screen for selection of systems and submitting request(Save & submit button in the end)
  • Screen 2 had a ‘Next’ Button. On click of the next button I captured the values of the controls in the form that were REQUIRED.
  • If they were deemed empty, then, user gets alerted about filling out REQUIRED controls in the form and the focus  gets set to the control that is empty.
  • Control settings for the single line text box store client id in JavaScript variable to YES, Client ID JavaScript variable name as varFirstNameID
    validation2
  • My controls that were required were
    • First Name
    • Last Name
    • Middle Initial
    • Department  or School(Drop down list, which is filters another cascaded drop-down list in the form for Manager of the department)
    • Manager

      As long as the fields values are entered, the form refuses to go to the next step for selection of systems, prompting users to fill out the required inputs.

  • This is the script that does the validation part and it is self-explanatory
    //This is the function that moves the screen from one form to another for submission
    function goStep(stepNumber)
    {
    var hiddenTxtBoxStep= NWF$(“#”+hiddenTxtBoxStepID);
    hiddenTxtBoxStep.val(stepNumber);
    NWF.FormFiller.Functions.ProcessOnChange (hiddenTxtBoxStep);
    //alert(stepNumber);
    if(stepNumber==”3″) ValidateControls();
    }
    //Function that is used to validate the REQUIRED controls. If they are empty then the form submission stops and doesnt progress to the next page for selecting systems.
    function ValidateControls(stepNumber)
    {
    //default value used to capture whether the control was empty or has value
    var validationError=false; 
    var firstName= NWF$(“#”+varFirstNameID);
    var fnVal= firstName.val();
    //control settings for the single line text box Store Client ID in JavaScript variable to YES, Client ID JavaScript variable name as varFirstNameID.  The setting above was for first name alone, I like using naming convention for Client ID and variables so its identifiable in the script and less chance of errors+ease of maintenance. This is applicable for all the controls in the section below for Last Name, Middle Initial, Department or School(lookup, drop down list) and Manager(cascaded filtered by department drop down list as well)
    var lastName= NWF$(“#”+varLastNameID);
    var lnVal= lastName.val();
    var middleInit = NWF$(“#”+varMiddleInitialID);
    var miVal= middleInit.val();
    var deptSchool= NWF$(“#”+varDepartmentSchoolID);
    var dsVal= deptSchool.val();
    var varManager= NWF$(“#”+varManagerID);
    var mVal= varManager.val();
    //alert(fnVal);
    //If validationError is true, then it means there is an empty value in the REQUIRED controls, so we have to fill them first after alerting the users.
    validationError= CheckValidationField(fnVal,lnVal,miVal,dsVal,mVal);
    //If it returns TRUE then there is an empty value, else if it is FALSE we are good to go.All required inputs are filled and systems can be submitted.
    if (validationError==true) {
    goStep(“2”);
    //Depending on what control is empty, focus is set to that control. If field is error: stop submission.
    if (fnVal==””) {NWF$(“#”+varFirstNameID).focus(); return false; }

    else if (lnVal==””) {NWF$(“#”+varLastNameID).focus(); return false; }

    else if (miVal==””) {NWF$(“#”+varMiddleInitialID).focus(); return false; }

    else if (dsVal==””) {NWF$(“#”+varDepartmentSchoolID).focus(); return false; }

    else {NWF$(“#”+varManagerID).focus(); return false; }
    }
    }
    function CheckValidationField(fnVal,lnVal,miVal,dsVal,mVal)
    {
    if (fnVal==”” || lnVal==”” || miVal==”” || dsVal==”” || mVal==””)
    {
    alert(“Required fields(First Name, Last Name, Middle Initial, Department or School and Manager) cannot blank.” );
    return true;
    }
    else
    {
    return false;
    }
    }

    This solved my validation issue in the form and trust this helps someone else as well facing the same situation. Thanks to all that tried to support and help.

  • References:
    François on SharePoint & more

My Validation issue is RESOLVED now. Feel free to use this as reference if you go through the same in your environment. Thanks.

Swetha.

Swetha Sankaran, Microsoft MVP(2017-2020) | Gen AI enthusiast Avatar

About the author

Hi! My name is Joan Smith, I’m a travel blogger from the UK and founder of Hevor. In this blog I share my adventures around the world and give you tips about hotels, restaurants, activities and destinations to visit. You can watch my videos or join my group tours that I organize to selected destinations. [Suggestion: You could use the Author Biography Block here]

Discover more from Woman In Tech: NAVIGATING THE DIGITAL WORLD

Subscribe now to keep reading and get access to the full archive.

Continue reading