DMXzone Security Provider PHP Support Product Page

Under investigation

Validate Data

Reported 21 Mar 2018 22:19:11
1
has this problem
21 Mar 2018 22:19:11 Raymond Wiggins posted:
I have a form whose data I'm inserting into a database. I check to see if the email is already in the database. The insert works fine if the email doesn't exist, but if I try to enter an email that is in the database, I get the following error in the Console (Chrome)

POST www.mydomain.com/dmxConnect/api/dbRegisterUser.php 400 (Bad Request) - jquery-latest.js:9631

Line 9631 is the xhr.send( ( options.hasContent && options.data ) || null );
which is called by line 9176 transport.send( requestHeaders, done );
called by dmxServerAction.js:165 var m = a.ajax(e(i, b(f)));

In App Connect Validator I have the correct POST expression, linked field matches the form ID/Name in the form, using the "Does Not Exist" validation rule with correct table/column/message. All the other rules (i.e. required, email type) seem to work perfectly. When a user attempt to create an account with the same email, they just aren't being notified in any way in the help-block - for the user, it just doesn't seem to do anything.

Please advise.



I've simplified the code for the form below to show the particular form item in question.

<form action="" method="post" class="text-center" name="regForm" id="regForm" role="form" data-dmx-validate="true">
<div class="form-group">
                <label for="regEmail">Email</label>
                <input name="regEmail" type="text" required class="form-control" id="regEmail" placeholder="" data-rule-email="true">
                <span class="help-block" style="display: none;">Please enter your email address.</span></div>
</form>


If it helps, below is the contents of my dmxConnect/api/dbRegisterUser.php file.

Replies

Replied 22 Mar 2018 08:48:19
22 Mar 2018 08:48:19 Teodor Kuduschiev replied:
Hello Raymond,
Please do not post all the code in the forum topics - it is not much of a help here.

I've re-read your topic a couple of times but still - i cannot understand what the issue is exactly? How is the .help-block class related to your serverside validation? What exactly is wrong?
Replied 22 Mar 2018 13:16:46
22 Mar 2018 13:16:46 Raymond Wiggins replied:
I was expecting the message "Email address already in database. Please try another email address." to appear inside the help-block if the email was already in the database. The problem is that users that erroneously try to re-register aren't getting any notification (to the user, they click submit and nothing apparently happens so it appears to them that the site is broken).

If the email doesn't exist in the database, it all works as expected with proper redirects and database insertion. So, that tells me the server side validation is working, but either not:
(1) triggering whatever method is used to populate the help-block (assuming that's where the message would be inserted).
(2) the method used to populate the help-block isn't changing the text correctly

Reply to this topic