cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
GMRaju3
Helper I
Helper I

How to disable / enable validation on a column basing on choice field selection

I have 2 columns code1 and code2. Code1 text is set to allow only numbers and code2 is set to allow only text for instance. code1 is hidden and code2 is visible when choice selected value is Yes. But the form is not submitting the form without values on both code1 and code2 , though code1 is hidden.

 

Please help. 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions

Here is what I would do.  There are 3 places to make changes.   What these will do is disable your submit button if the choice is No and code2 is blank.   It will clear code2 if the choice is Yes and the warning label will be displayed if the choice is No and code2 is blank.

 

In the choice OnSelect:

 

If(Self.Selected.Value = "Yes", Reset(code2))

 

 

In the Warning Label Visible:  Note you can set whatever criteria you need here, to include matching functions if code2 needs to match specific criteria like length or type of characters.

 

If(
    ChoiceControl.Value = "No"  && IsBlank(Code2.Text), true,
    false
)
     

 

 

In the DisplayMode for your submit button:

 

If(
   WarningLabel.Visible, DisplayMode.Disabled, DisplayMode.Edit
)

 

 

 

 



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

View solution in original post

13 REPLIES 13
JR-BejeweledOne
Super User
Super User

Try adding an If statement to your validation formula.    Something like this

 

If(
   Self.Visible, validation code here, ""
)

 

 



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.
PowerRanger
Resident Rockstar
Resident Rockstar

@GMRaju3 If the column is set to required in your datasource you can't change this behavior in powerapps.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.




​Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item.

If the content was useful in other ways, please consider giving it Thumbs Up.

Thank you for the reply. Sorry , Can you please let me know at which property as this is with the sharepoint custom form with many validations. Here is the sample replica at a test list.

GMRaju3_0-1644846030714.png

 

Thank you for the reply. Yes, Definitely not required fields.

@GMRaju3 When you go to SharePoint --> List Settings you will see a list of all fields for that list. Could you provide a screenshot for this?

 

 




​Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item.

If the content was useful in other ways, please consider giving it Thumbs Up.

Sure. Plz find attached.

GMRaju3_0-1644849652565.png

 

PowerRanger
Resident Rockstar
Resident Rockstar

@GMRaju3 OK. So this looks good. Nothing should prevent you to submit the Form even if Code and/or Code2 has no value.

 

Do you get an error message? Could you make your Code2 DataCard visible...do you see any errors? When you submit the form (with Code2 visible)...does it save? 

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.




​Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item.

If the content was useful in other ways, please consider giving it Thumbs Up.
JR-BejeweledOne
Super User
Super User

If there is validation for the text and the text doesn't 'match' the validation because it's blank, it won't save.



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

Sorry, I need to validate code2 textbox, if the choice value is No, before saving the form and stop save action in case not validated. The code2 text field needs to be blank or set to blank value if the choice value is Yes.

GMRaju3_1-1644851096304.png

 

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (1,291)