cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jaina
Helper V
Helper V

Custom Form - SPACE validation in single text field

Hello Experts,

I have a field called Transport Number, and I configure it to have a maximum length character to 10.

But user is inputting spaces to proceed. How am I supposed to validate the data if with space and less than 10 character, it will prompt an error?

 

In my submit button, here is my formula so that it will prompt an error and will not be saved

 

jaina_0-1652424715328.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @jaina ,

Try OnSelect

If(
   Len(
      Substitute(
         DataCardValuell.Text,
         " ",
         ""
      )
   ) <> 10,
   Notify(
      "Transport Number must be 10 characters long!", 
      Error
   ), 
   SubmitForm(SharePointForm1_NEW_EDIT)
)

and the Update of the Data Card

Substitute(
   DataCardValuell.Text,
   " ",
   ""
)

You will also have to make the maximum characters more than 10 (it is taken care of above)

 

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.

Visit my blog Practical Power Apps

View solution in original post

2 REPLIES 2
WarrenBelz
Super User
Super User

Hi @jaina ,

Try OnSelect

If(
   Len(
      Substitute(
         DataCardValuell.Text,
         " ",
         ""
      )
   ) <> 10,
   Notify(
      "Transport Number must be 10 characters long!", 
      Error
   ), 
   SubmitForm(SharePointForm1_NEW_EDIT)
)

and the Update of the Data Card

Substitute(
   DataCardValuell.Text,
   " ",
   ""
)

You will also have to make the maximum characters more than 10 (it is taken care of above)

 

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.

Visit my blog Practical Power Apps

jaina
Helper V
Helper V

Hello Sir @WarrenBelz  Thaaaaank you so much! It works! 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,837)