Jump to content

[Q]form validation js + php report missing fields next to actual field


amkaos

Recommended Posts

Hi:

i have simple form.

i use an external javascfipt file to validate required fields.... works fine if user has java turned on.

i have an external php file to validate after js .. it has separate error page listing missing fields..and a thank you page that works if form passes validation

i really want the php to report missing fields next to the actual boxes like the js does..

 

this is my jsbin link showing the html , css and js + preview window and how it works.::

  http://jsbin.com/osahah/1/edit

 

this is my php file

Send_Questions.php

-------------------------------

in trying to put errors next to same fields, i changed this working HTML code snip:
<div class="input">
<input type="text" name="email" id="email" size="30" /><span class="emailError, emailError2"></span>

<div class="error" id="emailError">
<p stlye="float:left"/>Requireclear.gifd: Please enter your email address
</div>

to this::

<div class="input">
<input type="text" name="email" id="email" size="30" /><span class="emailError, emailError2"></span>

<div class="error" id="emailError" value="<?php echo $error_message; ?>"><br>
<p stlye="float:left"/>Requireclear.gifd: Please enter your email address
</div>

i also tried ::
<div class="error" id="emailError" <span>"<?php echo $error_message.='Required: Please enter your email address'; ?></span><br>
<p stlye="float:left"/>Requireclear.gifd: Please enter your email address
</div>

the first snip is for js validation..it displays errors next to appropriate fields IF user java is turned on.
i wanted to keep the js validation and add the php validation using an external php file..
of course the php example doesnt work..
the $error_message comes from the .php file..
am i close?..

i have tried moving the tiny php line to other locations,,
also i tried with and without the <span> tag..
still i get taken to the error page..

thanx for lookin

i appreciate any help

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.