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

Regex Field Validation not working in Entity Form

Hello all,

 

I have set up an entity list with an entity form for editing CDS records. In the entity form metadata I have set up a regular expression for preventing numbers in street names. However, when I submit the form, the validation does not seem to work since it accepts "123" as street name. Have I missed a setting? My regex is ^[a-zA-Z]+$ , Field is require.

 

Thank you!

 

regex.PNG

4 REPLIES 4
justinburch
Microsoft
Microsoft

Hi @jandersen,

Have you made certain this is pointing to the right field? Your RegEx worked without issue for me.

Additionally, please make sure you have reset the cache. You can find some tips on working with the cache here: https://justinburch.com/cache-tips/

Hi @justinburch , thanks for the hint. Unfortunately clearing the cache did not solve the issue. Regarding your question if the metadata is pointing to the right field: I think it is, at least edits to the description & labels are reflected in the Portal. Are there any other settings that may be necessary?

 

metadata.PNG

Thanks for the clarification, @jandersen. That's definitely odd, if the label change and all is reflecting then you're definitely using the right one. I didn't have to do anything further for mine - I just made sure it was a text field and added the same RegEx, then as soon as I click "Submit" it shows my custom message once violated.

Are you able to try the same RegEx against a different field - maybe one with no other entity form metadata - to see if it works there? Maybe on a different entity form?

@justinburch, I set up a new form for the Contacts entity and used the same Regex validation for the job title field, and it works. Maybe there's something wrong with my custom entity but I can't find the cause. Since it's just a test environment I won't bother investigating further. Thanks for confirming that I didn't overlook anything :).

Helpful resources

Announcements
Carousel Community Blog

Check out the Community Blog

Read all about the most recent blogs in the 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.

Carousel News & Announcements

What's New in the Community?

Check out the latest News & Events in the community!

Users online (2,329)