Validation message not restricting form from submitting

Hi All

 

I am working on version 17.4.

In my main form, user is given dynamic links such that clicking on any link will direct the user to the corresponding interface.

These interfaces contain required fields. When user is on interface corresponding to link 1 i.e. he clicks on link Form 1 and he clicks on Submit button without entering values in the corresponding required fields; then he gets an error message "A value is required". Now he clicks on link Form 2 and he is diverted to corresponding interface. Here also all fields are required. User enters values in Form 2 interface but still leaves fields in Form 1 blank then user is allowed to submit the form.

This is an unexpected behavior as both interfaces are in one formLayout and since he has not entered values for required fields in Form 1 then he should not be allowed to Submit the form.

Below is code snippet for reference.

 

/* Code for Main Form*/

load(
  local!firstName,
  local!lastName,
  local!emailId,
  local!mobileNo,
  local!categorySelection:1,
  with(
    a!formLayout(
      label:"Details Form",
      contents:{
        a!richTextDisplayField(
        align: "CENTER",
        value: {
          /*Form 1*/
          " | ",
          a!richTextItem(
            style: if(local!categorySelection = 1, "STRONG", "NORMAL"),
            text: "Form 1",
            link: if(local!categorySelection = 1, null, a!dynamicLink(value: 1, saveInto: local!categorySelection))
          ),
          if(local!categorySelection = 1, {" ", a!richTextImage(image: a!documentImage(document: cons!FIL_ICON_SEARCH))}, {}),
          /*Form 2*/
          "| ",
          a!richTextItem(
            style: if(local!categorySelection = 2, "STRONG", "NORMAL"),
            text: "Form 2",
            link: if(local!categorySelection = 2, null, a!dynamicLink(value: 2, saveInto: local!categorySelection))
          ),
          if(local!categorySelection = 2, {" ", a!richTextImage(image: a!documentImage(document: cons!FIL_ICON_SEARCH))}, {}),
          " | "
         }
        ), 
        if(isnull(local!categorySelection),
           {},
           choose(local!categorySelection,
             rule!MYAPP_Form1(
               firstName:local!firstName,
               lastName:local!lastName
             ),
             rule!MYAPP_Form2(
               emailId:local!emailId,
               mobileNo:local!mobileNo
             )
           )
        )
      },
      buttons:a!buttonLayout(
        primaryButtons:a!buttonWidgetSubmit(
          label:"Submit",
          value:"Submit"
        ),
        secondaryButtons:a!buttonWidgetSubmit(
          label:"Cancel",
          value:"Cancel",
          style:"DESTRUCTIVE",
          skipValidatio:true
        )
      )
    )
  )
)



/*Code for rule!MYAPP_Form1*/

with(
  a!sectionLayout(
    contents:{
      a!columnsLayout(
        columns:{
          a!columnLayout(
            contents:{
              a!textField(
                label:"First Name",
                value:ri!firstName,
                saveInto:ri!firstName,
                required:true
              )
            }
          ),
          a!columnLayout(
            contents:{
              a!textField(
                label:"Last Name",
                value:ri!lastName,
                saveInto:ri!lastName,
                required:true
              )
            }
          )
        }
      )
    }
  )
)





/*Code for rule!MYAPP_Form2*/

with(
  a!sectionLayout(
    contents:{
      a!columnsLayout(
        columns:{
          a!columnLayout(
            contents:{
              a!textField(
                label:"Email Id",
                value:ri!emailId,
                saveInto:ri!emailId,
                required:true
              )
            }
          ),
          a!columnLayout(
            contents:{
              a!integerField(
                label:"Mobile No.",
                value:ri!mobileNo,
                saveInto:ri!mobileNo,
                required:true
              )
            }
          )
        }
      )
    }
  )
)

Thanks in advance!!

  Discussion posts and replies are publicly visible

Parents Reply
  • Thanks  for replying!!
    I don't want to skip the validation.
    My problem is the validation message that shows when I leave a mandatory field blank and submit the form my form is getting submitted. If you go through the attached code snippet; the skipvalidation is on Cancel button and not on Submit button.

    In my case, the validationgroup or validate functionality won't be of much help as my problem the mandatory field validation thrown out of the box not restricting the user from submitting the form without entering any value in mandatory field.

    Any other suggestions...

Children