Solved

SmartForms: Clearing conditional highlighted validation between validations.

  • 19 March 2018
  • 4 replies
  • 4 views

Hi there,

 

I am trying to see if it is possible to achieve the following:

 

I have a view with text boxes A B and C.  I also have two buttons, Button 1 requires that A has a value, Button 2 requires the A B and C all have values. (image 1)

 

I I first click Button 2, then the validation highlighting for all three boxes as expected (image 2). 

 

If I then click Button 1 the highlighting for all three text boxes stay as required, however only the first one actually needs to have a value inserted. (image 3)

 

Is there a way to clear the original validation highlighting from the first Button click?

 

I have tried to work around by calling from Button 1 a seperate "if the view passes validation" rule and setting it to validate a control that always has a value, to make the view pass that initial validation, hoping it would then revalidate, but this didn't clear it either (image 4)

 

Thanks

 

 

 

 


14225iFCD317CE17EDB3F7.png
12990iA590AB16CF544F2B.png
11227iD8521D3F9004F534.png
14980iCD1FE4CC59B1065C.png
13136iE0AA882C99DDB113.png
13517i792702740830B663.png
13920iB9C2AD6AC4FA33EB.png

icon

Best answer by Macky1 20 March 2018, 04:53

View original

4 replies

Hi guy, I tried add rule abit on button 1and it works from me. Just check on textbox A first that there is value or not if not any input, then transfer temp data and clear within that If. you can refer solution as image below:-


 



 


Thanks,


Mac

Badge +15

Hi,


 


The only way I can come up with to reset the style of your controls is by using javascripts. You can follow the guide here, and use the following javascript expression:


 


 <script>$('input.invalid').removeClass('invalid');</script>


 


Then each time you click on the buttons, just run the rule that will execute that script. However, please note that the above script will remove that red border style and tooltip for ALL input controls on your view or form. You cannot select which control you want to reset the style.


 


EDIT: Just saw the reply above. The reply above works as well. Once you input something into your text box, the style added by the validation rule should reset.

Thanks to both of you for your replies - both do indeed work.

 

I will go with the JavaScript version to save the compelxities of having to have many if conditions in a view for each control, especially as my validation involves a bunch of different views on a form as this is a one shot deal to call it once on the form,  even if this isn't really OOB behaviour

 

Cheers,

 

Paul

Badge +15

The javascript solution is more of a hack, so I won't really recommend it to people who are not really familiar with it. Anyway, since both solutions worked, I will just mark Macky's one as a solution in case someone is looking for a non-javascript solution.

Reply