cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Power_User2
Frequent Visitor

How to clear Text Input & Submit Form if condition is met

I have a Text Input and what I want to do is to submit the form (I have a SharePoint list) and clear the Text Input once the user has entered up to a certain number of characters.

So far I was submitting the values to the SharePoint list by setting OnChange = SubmitForm(Form1). It works, but what I really want to do is what I stated above. Thank you.

 

1 ACCEPTED SOLUTION

Accepted Solutions

The solution it's as follows for Barcode Scanners that do not have a camera (mine is powered by Android):

Set the button that's used to scan to act an 'ENTER' key as well. This can be done by enabling such option on the WD settings --> Key Stroke Output --> Basic Data Formatting --> Send 'ENTER' Key. Now when pressing the scan button not only the input is taken but the ENTER triggers the OnChange function, executing the function every time the user scans. 

View solution in original post

9 REPLIES 9
PG_WorXz10
Resident Rockstar
Resident Rockstar

Hi @Power_User2 ,

 

You can try below code if it helps your requirement. 

Default: ""
OnChange:    If(Len(YourTextInput.Text)>25,Reset(YourTextInput),SubmitForm(Form1))

 

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.

If this post was helpful or you need more help please consider giving Thumbs Up and Tag me in your reply I'll be happy to help. If this post helped you solve your issue please click Accept as solution and provide Thumbs Up. This will help others find it more readily.

Not working. And I want both conditions to happen. According to that formula, when length is greater than x (12 in this example), then the input text will clear; otherwise, it will submit. And it happens only OnChange. Taking this same example, what I want is:

 

If input text = 12, then reset & submit. But I want this to happen without having the user clicking on the TextInput again. Let's say I type 123456789000, I want the Form to be submitted && reset without having to trigger OnChange, because for that, the user would have to click on the box again.

Hi @Power_User2 ,

 

The onChange will be triggered when the user will end typing text in the TextInput. Lets say in your example when you are done with typing 123456789000 the onChange will be triggered. 

 

If input text = 12, then reset & submit. For this condition if you reset the value first and Submit than blank value will be added to the Backend. Let me know if this is what you want to achieve If so please see the below code for the same. 

 

Default: ""
OnChange:    If(Len(YourTextInput.Text)>25,Reset(YourTextInput);SubmitForm(Form1))

 

 

 

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.

If this post was helpful or you need more help please consider giving Thumbs Up and Tag me in your reply I'll be happy to help. If this post helped you solve your issue please click Accept as solution and provide Thumbs Up. This will help others find it more readily.

I expressed myself wrong. What I want:

If input text = 12, then submit & reset Input Text. 

OnChange is not being triggered when I'm done typing the 12 characters.

Hi @Power_User2 ,

 

Once your typing is done click outside the textinput control or press enter or move to other control so that the textinput  will know you are done with typing and it will trigger the onChange. 

 

Default: ""
OnChange:    If(Len(YourTextInput.Text)=12,SubmitForm(Form1);Reset(YourTextInput))

 

 

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.

If this post was helpful or you need more help please consider giving Thumbs Up and Tag me in your reply I'll be happy to help. If this post helped you solve your issue please click Accept as solution and provide Thumbs Up. This will help others find it more readily.

In a normal app, a user would do so. The problem is I am using a scanner, and no, I cannot use the scanner bottom because it's designed to be used with a camera, and that's not what I have. When I scan, the scanner takes the input, but if I scan again, it will just take the information again, and won't submit until I click outside, which is not useful because my idea is for the user to scan continuously without having to click the Text Input every time they want to submit and clear.  This is the reason why I was looking for a solution that would trigger submit and reset by some condition. Is it possible?

Hi @Power_User2 ,

 

In this case why don't to try triggering the formula on Scan itself ?

If this post was helpful or you need more help please consider giving Thumbs Up and Tag me in your reply I'll be happy to help. If this post helped you solve your issue please click Accept as solution and provide Thumbs Up. This will help others find it more readily.

Because I cannot use a scan button. I have a scanner device powered by Android; it doesn't have a camera. I have created a scanner app and yes, in my phone it works. The scanner device does not have a camera; therefore, the app keeps on asking for permission because it does not detect one. I cannot use a scan button.

The solution it's as follows for Barcode Scanners that do not have a camera (mine is powered by Android):

Set the button that's used to scan to act an 'ENTER' key as well. This can be done by enabling such option on the WD settings --> Key Stroke Output --> Basic Data Formatting --> Send 'ENTER' Key. Now when pressing the scan button not only the input is taken but the ENTER triggers the OnChange function, executing the function every time the user scans. 

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,402)