cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate I
Advocate I

Custom Text Field Required Field

Hi guys, I am creating an application that has text field but it was hidden until met certain condition. What I want to do is, if its not visible (the text field) I can submit the form as usual to data source, but if the text field is visible, then it will be a required field and user cannot submit the form until that field is fill up. Any suggestion to achieve this? Thank you.

p/s: I have use this formula but no luck. Even if the field is not visible, I'm still cannot submit it because it become disabled.

DisplayMode: If(And(!IsBlank(TextInput5.Text)),DisplayMode.Edit,DisplayMode.Disabled)

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User II
Super User II

Re: Custom Text Field Required Field

Ok, not a problem, so we change the logic of it to only be disabled when it's visible & empty?

 

 


If(
//If Its visible, but not filled, then disable the button
TextInput5.Visible && Len(TextInput5.Text)=0, DisplayMode.Disabled,

//If Its visible, and filled, then enable the button TextInput5.Visible && Len(TextInput5.Text)>0, DisplayMode.Edit,
//If Its not visible, then enable the button DisplayMode.Edit
)

 

 

 

Please take a look at revised POC and adapt to your needs,

 

Cheers,

ManCat


@iAm_ManCat

Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


View solution in original post

7 REPLIES 7
Highlighted
Super User II
Super User II

Re: Custom Text Field Required Field

Hi,

 

Instead of DisplayMode, why don't you change the Visible setting?

 

Visible: !IsBlank(TextInput5.Text)

 

The same would apply for Required :

 

Required: !IsBlank(TextInput5.Text)

Could you try this and let me know how you get on?

 

Cheers,

ManCat


@iAm_ManCat

Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


Highlighted
Advocate I
Advocate I

Re: Custom Text Field Required Field

Thanks for the suggestion I tried it, but when it visible, I want my submit button to be disabled until the visible textfield is filled up and when it filled then I can click on the submit button.

Highlighted
Super User II
Super User II

Re: Custom Text Field Required Field

Ok, well that's also do-able - although having the conditional Required flag on the Datacard for TextInput5 will mean that you can't submit it without filling it in...

 

So to have your Submit button be disabled until that TextInput5 is filled, set its Displaymode Property:

 

DisplayMode: If( Len( TextInput5.Text)>0, DisplayMode.Edit, DisplayMode.Disabled)

This checks if there's anything in the TextInput5, if yes then Submit button enabled, otherwise its disabled - if you want it to be disabled until they've typed a certain number of characters, then change the >0 to something else like >4

 

I've attached a POC for this, hopefully you find it useful 🙂

 

Cheers,

ManCat


@iAm_ManCat

Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


Highlighted
Advocate I
Advocate I

Re: Custom Text Field Required Field

Thank you. That's work for disabling the submit button, but if the TextInput5 is not visible then I'm stuck with the button that has been disabled. I cant use Required since the field is not required. It's only become required when it's visible. If it's not visible then it's not required to be filled up.

Highlighted
Super User II
Super User II

Re: Custom Text Field Required Field

Ok, not a problem, so we change the logic of it to only be disabled when it's visible & empty?

 

 


If(
//If Its visible, but not filled, then disable the button
TextInput5.Visible && Len(TextInput5.Text)=0, DisplayMode.Disabled,

//If Its visible, and filled, then enable the button TextInput5.Visible && Len(TextInput5.Text)>0, DisplayMode.Edit,
//If Its not visible, then enable the button DisplayMode.Edit
)

 

 

 

Please take a look at revised POC and adapt to your needs,

 

Cheers,

ManCat


@iAm_ManCat

Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


View solution in original post

Highlighted
Advocate I
Advocate I

Re: Custom Text Field Required Field

Thank you so much! That solved it. Love you. Smiley Very Happy

Highlighted
Super User II
Super User II

Re: Custom Text Field Required Field

You're welcome!

 

Hopefully you've managed to gain both a working process and more knowledge on PowerApps? We are all here to learn, I've learnt something today already by helping to solve another issue on here 🙂

 

Cheers,

ManCat


@iAm_ManCat

Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,321)