Forums

Validation Not Working

zoom 14 Dec, 2007
Unless I'm doing something incorrectly it seems the validation isn't working correctly when you insert php code into the form. I have a simple form in which I pull a list of data from a table in order to populate a dropdown listbox. If I remove the code the validation stuff works, however with the code it doesn't.

Has anyone else experienced this problem? Is there a workaround, or do I have to code my own custom validations? Below is my code snippet from the form I'm building with ChronoEngine.


<div>
  <table border="0" cellspacing="1" cellpadding="2">
  <tr>
     <td><label for="Event">Select Event:</label></td>
     <td>
       <select size="1" paf="" emsg="" class="inputbox" name="Event">
          <option value="Select One..." SELECTED></option>
<?
global $database;

$sql = "SELECT title from #__eventlist_dates where published = 1 order by dates;";
$database->setQuery($sql);
$rows = $database->loadObjectList();

 foreach($rows as $eventitem) {
    echo "<option value=\"" . $eventitem->title . "\">" . $eventitem->title . "</option>\n";
  }
?>
       </select>
     </td>
   </tr>
</div>
<br><br>Post edited by: zoom, at: 2007/12/14 18:43
GreyHead 15 Dec, 2007
Hi zoom,

This all looks good to me and I don't know any reason why the imageverification wouldn't work with it.

What does the page source html look like? I wonder if some other conflict is creeping in?

Bob
zoom 17 Dec, 2007
Greyhead,
It's not the imageverification that's failing, it's the field validations which don't seem to work.
GreyHead 17 Dec, 2007
Hi zoom,

Is the form on-line? Can I take a look at the published html?

Bob
zoom 18 Dec, 2007
Greyhead,
I looked at the HTML and it seems fine. I've made the formavailable for you.
GreyHead 18 Dec, 2007
Hi Zoom,

Looks as though the form name isn't being picked up properly in the JavaScript. Sorry, I have a touch of flue right now and my eyes just go crossed when I try to dig any deeper.

Bob

<br><br>Post edited by: GreyHead, at: 2007/12/17 20:02
zoom 18 Dec, 2007
Greyhead,
No Problem.. Interestingly enough if you remove the php code from the form it seems to work. I'll see if I can repair the javascript on my end.
GreyHead 18 Dec, 2007
Hi zoom,

Thanks, I do not understand logically why having the php in or out would make a difference - I wonder if there's an unclosed tag somewhere?

Bob
This topic is locked and no more replies can be posted.