How to solve dmxvalidatorerror

Hi

I would like to show two types of comment depending on “eventname” exists in db or not.
When I set like below, I’ve got dmxvalidatorerror on part. And nothing shows about this part.

Here is the page I made, http://174.138.46.199/create_a_new_event/

<form id="eventnameck" is="dmx-serverconnect-form" action="dmxConnect/api/Data/eventnamecheck.php" autosubmit="true" method="post">
	<input type="hidden" name="hidden2">
</form>
<form method="post" accept-charset="utf-8" is="dmx-serverconnect-form" id="serverconnectform1">
(ellipsis)
<div class="form_col">
	<h2 class="mt-0 text-left">Event Name<span class="caution">*</span></h2>
	<input name="eventname" class="max" type="text" id="eventname" required="required" dmx-on:keyup="eventnameck.hidden2.setValue(value)">
	<did id="availability">
		<p style="color:green" dmx-show="eventnameck.data.query1 == 0" dmx-hide="(eventname.value.length() == 0)">Available</p>
		<p style="color:red" dmx-show="(eventnameck.data.query1 > 0)" dmx-hide="(eventname.value.length() == 0)">This event name is not available, please choose the 							different name.</p>
	</did>
</div>

I can see the return like this

but dmx-show doesn’t work as expected…how can I solve this?

What should this check exactly?
Also - please add an alias for the count in the query builder.

This is server action.


This is the query builder screen shot.
スクリーンショット 2020-09-09 21.04.15

<dmx-serverconnect id="serverconnect2" url="dmxConnect/api/Data/eventnamecheck.php" dmx-param:eventname="eventnameck.hidden2.value"></dmx-serverconnect>

here, I would like to check if eventname.value exists in the database already or not. if eventnameck.data.query==0, which means the same eventname as input’s eventname doesn’t exist in db.

Thank you.

Your query cannot return 0 … not sure i understand what exactly are you trying to check? The following expression is wrong: eventnameck.data.query == 0

for example, “Dummy1” exists in db as “eventname” already.

I expect this red comment and green comment shown under Event Name input like below.

Should it be dmx-show="eventnameck.data.query1.eventname==0" ?

if you are trying to check for an empty dataset then you can use

!eventnameck.data.query.hasItems() or even just !eventnameck.data.query

As i explained- add an alias for the count in the query builder first - for example “totalevents”. Then you can check it like:

eventnameck.data.query.totalevents == 0

I did it now, but dmx-show part is not working.

and the same error shows up yet.
スクリーンショット 2020-09-09 21.31.40

What error? Can you please explain what exactly are you doing and what is the error you are referring to?

this is how I set dmx-show now, but these both p-tag parts became “display: none;” and “dmxValidatorErrorserverconnectform1eventname” div-tag appeared. like attached image in my previous comment.

Can you just put somewhere below your input the following:

<p> Event check: {{eventnameck.data.query1.totalevent == 0}} </p>

and let me know if it properly returns true/false?

I did this one. please see the image below.

your check’s return is “true” but Dummy1 exists in db and query1.totalevent was 1.

But when exactly do you want to check this: eventnameck.data.query1.totalevent ? Is this on submit?

No, not on submit, I would like to check eventnameck.data.query1.totalevent when any text is put in this eventname input, this serverconnectform1 has 4 steps (not this hidden one, named “eventnameck”) and this input is on the 1st step, I wanted to validate eventname input data before moving to the 2nd step. So I’m trying to use keyup in the dynamic attribute.

by the way I removed this one.

Ok let’s start from the beginning. Can you shortly explain what exactly is your idea on the page?

Thanks,

here is what I want to do.
1)I would like user to fill required info in the form, called serverconnectform1.
2)but serverconnectform1 is too big, so I divided it into 4steps, by refering to https://docs.wappler.io/t/creating-multi-steps-forms/10799
3)if validate all the information in the form, when serverconnectform1 is submit, it is too many and I don’t want users to go back to the previous step or even before to correct input information.
4)So I would like to validate input data step by step.
5)on this 1st step, I need to check the data existence only for eventname in the database.

At the beginning, I was trying to do How to validate form input value realtime?
but I changed my mind, now I am trying to do the current question one.

So what should be validated when?

now I would like to validate “eventname” with db, if it exists already or not, real time again.
other data validation is not required to do server connection.

what I want to do is like this example (please see demo part).

It seems there was id’s conflict.

I could solve the problem somehow.

I did the following things.

this is for serverconnect and parameter.

<dmx-serverconnect id="eventnameck" url="dmxConnect/api/Data/eventnamecheck.php" dmx-param:eventname="eventnameckdummy.hidden2.value">
</dmx-serverconnect>

This is for hidden dummy form.

<form id="eventnameckdummy" is="dmx-serverconnect-form" action="dmxConnect/api/Data/eventnamecheck.php" autosubmit="true" method="post">
	<input type="hidden" name="hidden2">
</form>

This is an input for the validation this time.

<input name="eventname" class="max" type="text" id="eventname" required="required" dmx-on:keyup="eventnameckdummy.hidden2.setValue(value)">

Thank you so much.