cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AadilAhmed
New Member

Control Text Property returns Blank even though it has value

I have a form in Canvas App which is connected to a SharePoint list. It has a numeric field. So when submitting the form I'm checking if that field (CreditCardNumber) has sixteen digits entered.

 

OnSelect Submit Button - If(Len(CreditCardNumber.Text) <> 16,Notify("Please Enter 16 Digit Credit Card Number",NotificationType.Error),SubmitForm(Form1);NewForm(Form1));

 

AadilAhmed_0-1641543038216.png

 

 

So now the issue I m facing is even though I have entered(16 digits) value in the field the "CreditCardNumber.Text" is returning blank. It was working fine a day before but now its returning blank and I m getting the notification message "Please Enter 16 Digit Credit Card Number" as a result.

 

AadilAhmed_1-1641543128720.png

 

 

When I tried to see if the same thing works in OnChange property of the field, there its ("CreditCardNumber.Text") showing the value.

 

AadilAhmed_2-1641543195193.png

 

 

I am not able to figure out why its returning blank in OnSelect or anywhere else other than OnChange of the field.

 

Can anyone point me in the right direction?

 

Thanks for the help in advance!

5 REPLIES 5
JR-BejeweledOne
Super User
Super User

To be honest I am not exactly sure why text input fields even have an OnSelect property.    That property is so you can tell it what happens when someone clicks on the text field.

 

OnChange is where the 'magic' happens.   When the value changes, do something.

 

Try this instead in your Submit button.   This will eliminate the need to have a collection of the result of the split, as split creates a table that you can use.

 

If(
    (Count(Len(Split(CreditCardNumber.Text, "")).Result) <> 16,Notify("Please Enter 16 Digit Credit Card Number",NotificationType.Error),SubmitForm(Form1);NewForm(Form1));

.  



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

Hi @AadilAhmed ,

You are yet another victim of this bug - hopefully it will be fixed soon. In the meantime, you could set a Variable on the OnChange of the Text control and test for that.

I require the table created by spilt there is a big functionality depending on that table from split. For a normal text field this OnChange is working fine but for a field embedded in EDIT FORM from a SharePoint list its not working as expected. Wanted to see if this is a bug.

So a field in edit form with SharePoint list as a data source cant create a collection on OnChange of that field?

Hi @AadilAhmed ,

You need to do some testing on that - the bug does not seem to be consistent.

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.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (4,888)