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

13 REPLIES 13

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.

@GMRaju3 Where/How do you do the validation for code2?

 

 




​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.

Thanks @PowerRanger ,

Here is how I did now at the visible property of the warning label.

GMRaju3_0-1644856560684.png

 

HI JR,

 

Thanks a lot. That works ! 

Helpful resources

Announcements
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
Top Kudoed Authors
Users online (4,171)