cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
nikfikrie92
Level: Powered On

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
Super User
Super User

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




Don't forget to 'Mark as Solution' and 'Thumbs Up' those who deserve it!
7 REPLIES 7
Super User
Super User

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




Don't forget to 'Mark as Solution' and 'Thumbs Up' those who deserve it!
nikfikrie92
Level: Powered On

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
Super User

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 Smiley Happy

 

Cheers,

ManCat




Don't forget to 'Mark as Solution' and 'Thumbs Up' those who deserve it!
nikfikrie92
Level: Powered On

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.

Super User
Super User

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




Don't forget to 'Mark as Solution' and 'Thumbs Up' those who deserve it!
nikfikrie92
Level: Powered On

Re: Custom Text Field Required Field

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

Super User
Super User

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 Smiley Happy

 

Cheers,

ManCat




Don't forget to 'Mark as Solution' and 'Thumbs Up' those who deserve it!

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 188 members 4,576 guests
Please welcome our newest community members: