Process Mapping Logo

Process Mapping - Forums

Sharing 19 years of knowledge and experience

 
Metastorm BPM forums
Sign up Latest Topics
 
 
 


Reply
  Author   Comment  
matt_65

Member
Registered:
Posts: 32
Reply with quote  #1 
I have a requirement to have a form with a radio group (Yes, No) which is a required field, if the user selects Yes then a number field and another radio group will appear and these two fields are required to be completed, if they are not completed the form cannot be submitted.

I am not sure on what is the best method of implementing this requirement.

The form has the three fields (radioGroup1, number1, radioGroup2) and the forms cancel and submit buttons.

Can I intercept the submit button press and check the value of radioGroup1 and if Yes and there is no value for number1 or radioGroup2 then cancel the submit?

I have started a client script for the On form Submission event but just not sure if or how to implement the cancelling or proceeding of the form submission.

Any help would be greatly appreciated.

Edit, should mention that I am running MBPM 9.0 SR3.



Matt
0
matt_65

Member
Registered:
Posts: 32
Reply with quote  #2 
Got it working.  I created a client validation script which was called in the On form submission event:

return form_Validation();


Then in the form_Validation function perform checks and return a true or false.


function clientDesignate_Validation() {
 var sMessage = "";
  // check required fields
 
 // Check grpUnsophisticated, if Yes then check that the UDTMT1 is not 0
 // and a value has been selected for mfixcap radio group
  if(eworkGetField("grpUnsophisticated","") == "Yes, it is an unsophistacted client")
  {
   // If the UDTMT1 field is empty append to the sMessage variable
  if(eworkGetField("UDTMT1","") == 0)
  {
    sMessage +="- Quoted Cost\n";
  }
  // If the mfixcap field is empty append to the sMessage variable
  if(eworkGetField("mfixcap","") == "")
  {
    sMessage +="- Quoted Cost Type\n";
  }
 
  // if we have at least one missing field, prepare the message for the user
   if(sMessage != "")
   {
     // Add a meaningful bit of text to the message and append the fields that are missing values
   sMessage = "Please ensure all the required fields are populated:\n" + sMessage; 
   
   // Display a Javascript alert
     alert(sMessage);
   
   // Prevent the form submission
   return false;
   }else{
   // The user selected yes in the grpUnsophisticated field but has completed
   // the other fields, allow the form submission to continue
   return true;
  }
  }else{
  // The user selected no in the grpUnsophisticated field allow the form submission to continue
   return true;
 }
}


Thanks,

Matt

 




0
BMellert

Guru
Registered:
Posts: 688
Reply with quote  #3 
That works or using built-in functionality I do the same thing by:

Create all 3 fields as required.
Make the number1 and radioGroup2 display only when the yes option is chosen (Only show when radioGroup1.1 presuming Yes is the first option)

On save, MBPM itself will validate that all visible required fields are filled in.  If the fields are not displayed due to "show when" then they are not required.  (Note this does not work if the "optionally required" fields are shown/hidden via a panel.  They must have the visibility themselves on.)

It may also be worth adding a "on save" to clear the values if No is selected in case then chose yes, entered value, then chose no on the first radio button again.  That depends on whether those values should stick or be empty/blank if No is selected on the first.
0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:


Create your own forum with Website Toolbox!