Server side validator, what's wrong?

Hello everybody!

I have a query wich returns forms sended by the user.
From each form I make a condition and if it’s true, then insert a “9”.
The api works great, but I recently added a validator to avoid duplicates and I don’t know why it’s not working.

Everytime I execute the api:

First attempt


image
Second attempt

image

And so on.
Any idea?
Thanks in advance

Is formulario_puntos your id field in the database?

Hi Heather, and thanks for your reply!
Yes it is
image

What I found strange after doing some search, is that I have two squeryform.id, as I’m getting an object.

And

I can’t see anything amiss straight off the bat so just going through what I would look at…

Are you getting the error message on your form?
If so, try changing the message to make sure that’s where the action is happening.

If you’re not getting the message, or the message doesn’t change then make sure you don’t have an insert step elsewhere in your server action that’s doing the insert.

No errors,

It’s the only insert9 step I have on the entire api.

I also created on the repeat a set value named insertedid wich is binded to the form id
image

But it’s running in other order:
image

I also created a setvalue in the top of the repeat and having the same issues with the correct order:


image

Bump please, does anybody see anything wrong on my steps? It’s a bug?

Hey @franse,

I am not able to follow the steps you are doing and of course I cannot investigate your code or suggest a solution myself…
But for sure I would have start by searching very deep and carefully the validation step since this is the extra step that creates the problem…
(I can’t even imagine what the validation checks for because of the language).
I’m sorry but I think if you start seeing your validation with clear mind, you will figure it out probably

1 Like

Thanks @famousmag kindly as always.
The truth it’s I’m showing that I have a repeat of a form wich retrieves others forms with the respective ID (in this case we see the problem is on the ID 51 but it happens in all the ID’s)

The ammount of conditions of course may be confusing, but the thing results as:
Condition - Then - Insert

The insert is happening, but why not the previous validate step?
It’s just right before the insert step.
The validate takes “Already exist 51” and then it’ll insert anyway.
The only workaround I found was making a query and a condition if has value (like the validate will do):
Then -
Else - Insert
So my guess it’s the validate wich is not working properly.

Thanks again my friend for the reply :slight_smile:

  1. Can you just export (value->output) the values that should match or not match to check the values?
  2. can you just check the binding of the values in validation? (are you sure you have clicked the right field?)

You can see on my picture that i’ve tried with insertedid or idform.
idform is placed at the top of the repeat:

image
and insertedid before the validate and insert
image

Turns to:
image
(BTW don’t know why the set value insertedid turns to be after the insert)

100% sure
image
image

Found this topic, so I guess it’s not possible have a validate step on a repeat:
www.community.wappler.io/t/how-to-add-a-server-side-validate-step-on-a-repeat-element/18431

And the workaround:

I’ll wait to the team confirms that it’s impossible to make it work, and then I’ll create a FR for having a validate on repeat.