How to validate data in server action

I’m trying to validate an entry on a server action. The post value of Level is 4 but it does not fail validation (server actions after that still run)

What am I doing wrong?

The linked field is wrong, it needs to be the name of the field on the front-end.

Just try entering level.

thank for replying, I appreciate it

I’ve actually tried it both ways still no luck.

No problem.

Set the server side to debug, enter the form value, click submit and look at the debug to make sure the expression is being validated.

Set the validator to output as well, open console log and look at the response.

Make sure your linked field is change to ‘level’ instead.

The above should give you a good starting point in debuging it.

Oh thanks so much, I need to get better with the dev tools, but I changed it to the form field inp_level and I think that did the trick!

No worries, it takes time… but stick with it… it’s worth it.

2 Likes