Validate an entry from database

I am trying to create a coupon to apply to my items. I created a data type Coupon which has a code and a expiration date.
I have a place where I ask user to type in the code.

On enter, I would like then this field to become green and show the code in bold if the input code matches one in Coupon data as well as the exp. date as compared to current date.
If the date of the code is expired or the code is wrong then I want it to blank out the input or say, “Not valid”
Can’t get this to work.
Thanks for your help.

This is not working.

I think you need to include the code as a constraint within the search–not compare the input’s value to the first code in the list of codes returned by your current search.

You may also need to move the evaluation to a workflow triggered by something like a submit button, rather than in the input’s own conditions.

Tried that. I get a message but nothing in the input box. I would like it to say it was bad or good.

Have a look at this

Demo

Editor

1 Like

The input’s placeholder property governs the ghost text that appears in an empty input upon page load. Perhaps you mean to change the input’s actual value, which is governed by its initial content property.

1 Like

Alex, Thank you very much. Yes this is exactly what I was trying to do. But of course, I was not even close to the way it needed to be done. Thank you again.
Best, Charan

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.