Columbus Endpoint Management User Group

 View Only
  • 1.  Custom validation on PercentEdit component not working

    Posted Mar 05, 2012 08:28 AM

    I am modifying our New User submission form as HR has requested me to make a few additions to the form.  One of the additions is to add a PercentEdit component and require it to be filled in only if a radio button on the form is set to a specific value.

     

    I've been able to accomplish this with other TextBox components via Custom Validation, but it doesn't seem to be working on the PercentEdit component.

     

    I've tried the following:

    • Variable Exists rule followed by a Number Range Rule (less than 0, 0, more than 0) with failure paths on the variable exists = false and number range less than zero paths
    • Variable Exists rule followed by a Text Contains "NaN" Rule (that's what the variable seems to be named if no entry is made) with failures on the variable exists = false path and the text equals "NaN" path

     

    I'm drawing a blank.  I can't figure out how to make this thing required, and I can't just set it as "Required" since there will be some instances where it's NOT required.  Help?



  • 2.  RE: Custom validation on PercentEdit component not working

    Posted Mar 05, 2012 08:30 AM

    I should clarify that when I'm referencing the variable, I've been using ThisFormData.variablename, not just variablename.



  • 3.  RE: Custom validation on PercentEdit component not working

    Posted Mar 05, 2012 05:36 PM

    I just tested this using an Equals rule instead.

    First, set the default value of the percentage editor to 0.

    Then use a text contains rule to determine the ThisFormData value of the radio button.

    If it's a value that needs the percentage, do an equals rule on the ThisFormData of the percentage variable (select a decimal type).

    If it equals zero, show the error, if it does not, then allow it to continue.

    Rob



  • 4.  RE: Custom validation on PercentEdit component not working

    Posted Mar 06, 2012 07:41 AM

    Thanks for the info, Rob.  Unfortunately, a valid percentage in my case could be zero, though, so that wouldn't work.

    I ultimately want to have the value displayed on an e-mail further down the stream if any value was keyed into the field, but not displayed if it's still blank when the user goes through the form.

    Aside from assigning it a default value of a negative number and having to explain to people that negative values = blank, I don't know how to accomplish it outside of using a standard text box (which I can make behave in this fashion) and hoping that the users don't enter anything that doesn't make sense.



  • 5.  RE: Custom validation on PercentEdit component not working
    Best Answer

    Posted Mar 06, 2012 10:21 AM

    Ok, then if 0 is a possible value, what you need to check for is a NULL condition. Interstingly the NULL value for a percentage field is NaN. This is what I did, and it seems to be working. It would require the user enter the 0 value though...

    I set the Percent field to Optional, and I put the validation on the Submit Button.

    The validation is as follows:

    Text Contains Rule to see what the ThisFormDataValue is for Radio Button.
    If text is not the value you are looking for, error is NULL and form proceeds.
    If text IS what you are looking for, then put a Merge Text Component and put in the ThisFormData. Percent Variable. Set the output to PercentText.

    Now do an equals rule, text Type, and look for a value of NaN in the PercentText var (it will not be ThisFormData since it is directly in the stream). If the value is NaN, then show the error. Any other text is a number and thus would be valid.

    Rob



  • 6.  RE: Custom validation on PercentEdit component not working

    Posted Mar 06, 2012 04:09 PM

    Validation on submit, interesting.  I'll have to give that a shot.  It was NOT happy when I tried to put that same validation on the PercentEdit control.



  • 7.  RE: Custom validation on PercentEdit component not working

    Posted Mar 30, 2012 10:22 AM

    So did it work for you ?

     

    Rob



  • 8.  RE: Custom validation on PercentEdit component not working

    Posted Apr 03, 2012 11:44 AM

    Yep, sorry it took so long to get back to you on this.  I got sidetracked on some other stuff and couldn't pick it back up until today.

    Your description was a little confusing.  All I did was set the output path on the actual percent edit component to optional then put custom validation on the Submit button with a Text Contains Rule for ThisFormData.componentvariablename contains NaN and that seemed to do the trick.

    I'll have to remember putting validation on the submit button if I run into this issue with other components in the future!