Workflow and ServiceDesk Community

 View Only
  • 1.  Required field if another field is checked

    Posted Aug 18, 2011 11:51 AM

    I have a form with various check boxes on it for employee provisioning.  I'm going to add a number of hidden feilds that only appear if the initial check box is checked.   I'd like to know if theres a way to make one of those hidden fields mandatory if the initial check box is checked. 

    Hopefully thats clear. 



  • 2.  RE: Required field if another field is checked

    Posted Aug 18, 2011 12:19 PM

    On the submit button of your form, click the checkbox for Custom Validation on the Functionality tab. This will allow you to specify a model to determine validation. Your model should look like the 2nd picture (approximately):

    If checkbox checked (True False Rule) and no text in textbox (Get Text Length of ThisFormData.textoutput + Number Range Rule) throw a fatal rulebreak (Create Value option of 1st picture) with the error text in "Name" in the End component

    Else return a null rulebreak in your End component (Null Value option of 1st picture)



  • 3.  RE: Required field if another field is checked

    Posted Aug 18, 2011 02:17 PM

    Thanks for the quick response.  Wouldn't I check for the check box first?  Then validate the information in the textbox?  It's not working for me at all right now..



  • 4.  RE: Required field if another field is checked

    Posted Aug 18, 2011 02:45 PM

    Yeah it should. Was in a hurry earlier. Model should look something like 2nd picture below.

    Also, use ThisFormData.<checkboxoutput> variables when you check against the true/false rule, and the ThisFormData.<textboxoutput> for the Get Text Length component.




  • 5.  RE: Required field if another field is checked

    Posted Aug 18, 2011 03:15 PM

    Well I had to add the validation to the actual text feild I wanted to make sure was filled in.  It works now.. 

     

    Is there something I can add to a text box as default so that when it has nothing in it, it will just show up blank on my email notifications instead of "Not Found"?



  • 6.  RE: Required field if another field is checked

    Posted Aug 18, 2011 03:28 PM

    Nevermind.. found it.. right in front of me.. I was looking for it in the wrong place.. found it in the email contents.  Just removed the NOT FOUND text in there.



  • 7.  RE: Required field if another field is checked

    Posted Aug 18, 2011 03:32 PM

    Your best option is to use a Merge Text component before the email notification to sanitize the textbox output. You can change the Not Found to whatever you choose (I used NOT SPECIFIED in the pic below... and yeah, abc is my textbox output, not very descriptive, I know)