Jump to content

form wont send in ie7, validation wont work?


chen2424

Recommended Posts

Hi Guys,

 

im using chrome and ff and it worked fine till i tested on ie7 and the form just wont send on ie7. it gives me a validation error msg "SOME VALUES ARE NOT ACCEPTABLE" when i try to submit.

 

ive tried so many things and i cant figure out why ie7 wont send upon submit like ff does, code seems to be fine,  pls see validation coding line 7 - 32 , any phpGURU advice will be much appreciated! thanks for helping! :confused:

 

<?php defined('_JEXEC') or die('Restricted access'); ?>
<?php JHTML::_('behavior.formvalidation'); ?>
<script language="javascript" type="text/javascript">
function submitbutton(pressbutton)
{
var form = document.adminForm;
if (pressbutton == 'cancel') {
	submitform( pressbutton );
	return;
}

// do field validation
if (document.getElementById('jformfirstname').value == ""){
	alert( "<?php echo JText::_( 'Firstname is missing.', true ); ?>" );
} else if (document.getElementById('jformsurname').value == ""){
	alert( "<?php echo JText::_( 'Surname is missing.', true ); ?>" );
} else if (document.getElementById('jformemail').value == ""){
	alert( "<?php echo JText::_( 'Email is missing.', true ); ?>" );
} else if (document.getElementById('jformphone1').value == ""){
	alert( "<?php echo JText::_( 'Phone1 is missing.', true ); ?>" );
} else {
       if (document.formvalidator.isValid(form)) {
			submitform( pressbutton ); 
        }
        else {
                alert("<?php echo JText::_( 'SOME VALUES ARE NOT ACCEPTABLE.', true ); ?>");
        }


}
}
</script>
<?php if ($this->courseid){ ?>
<?php if ( $this->params->def( 'show_page_title', 1 ) ) : ?>
<div class="componentheading<?php echo $this->params->get( 'pageclass_sfx' ); ?>">
	<?php echo $this->courseDetails->title; ?>
</div>
<?php endif; ?>
<h3>Course Details</h3>
<table cellSpacing=0 cellPadding=5 width="90%" border=0>
   <tr>
      <td width="20%"><?php echo JText::_( 'Course Title' ); ?>:</td>
      <td width="30%"><?php echo $this->courseDetails->title;?></td>
      <td width="20%"><?php echo JText::_( 'Code' ); ?>:</td>
      <td width="30%"><?php echo $this->courseDetails->code;?></td>
   </tr>
  <tr>
<td><?php echo JText::_( 'Price' ); ?>:</td>
      <td><?php echo (number_format($this->courseDetails->price,2));?></td>
     <td><?php echo JText::_( 'No. of Days' ); ?>:</td>
      <td><?php echo $this->courseDetails->capacity;?></td>
   </tr>
   <tr>
<?php if ($_GET['hide'] != 1 ) { ?>
      <td><?php echo JText::_( 'Location' ); ?>:</td>
      <td><?php echo $this->courseDetails->course_location;?></td>

<?php

      }
      else
      {
          echo "<td> </td>";
          echo "<td> </td>";
      }

      ?>
   </tr>


   <tr>
         <?php if ($_GET['hide'] != 1 ) { ?>

     <td><?php echo JText::_( 'Start Date' ); ?>:</td>
     <td><?php echo Date('d-M-y', strtotime($this->courseDetails->start_date));?></td>


      <?php

      }
      else
      {
          echo "<td> </td>";
          echo "<td> </td>";
      }

      ?>
   </tr>

</table>

<?php } ?> 

<?php if ( $this->params->def( 'show_course_sessions', 1 ) && ($this->courseid) ) : ?>
<h3>Sessions</h3>
<table cellSpacing=0 cellPadding=5 width="90%" border=0>
<tr>
   <td width="20%" align="center" height="20" class="sectiontableheader<?php echo $this->params->get( 'pageclass_sfx' ); ?>">
      <?php echo JText::_('Day');  ?>
   </td>
   <td width="20%" align="center" height="20" class="sectiontableheader<?php echo $this->params->get( 'pageclass_sfx' ); ?>">
      <?php echo JText::_('Start Time');  ?>
   </td>
   <td width="20%" align="center" height="20" class="sectiontableheader<?php echo $this->params->get( 'pageclass_sfx' ); ?>">
      <?php echo JText::_('Finish Time');  ?>
   </td>
   <td width="10%" align="center" height="20" class="sectiontableheader<?php echo $this->params->get( 'pageclass_sfx' ); ?>">
      <?php echo JText::_('Duration');  ?>
   </td>
   <td width="30%" align="center" height="20" class="sectiontableheader<?php echo $this->params->get( 'pageclass_sfx' ); ?>">
      <?php echo JText::_('Location');  ?>
   </td>
</tr>
         <?php
  $k = 0;
  $n=count( $this->course_sessions );
  if ($n > 0){
   for ($i=0, $n; $i < $n; $i++)
   {
      $row = &$this->course_sessions[$i];
      ?>
            <tr>
               <td align="center">
      <?php echo $row->session_day;?> 
               </td> 
               <td align="center">
      <?php echo date('H:i', strtotime($row->start_time));?> 
               </td> 
               <td align="center">
      <?php echo date('H:i', strtotime($row->finish_time));?> 
               </td> 
               <td align="center">
      <?php echo $row->duration;?> 
               </td> 
               <td align="center">
      <?php echo $row->session_location;?> 
               </td> 
            </tr> 
    <?php 
    $k = 1 - $k;
   }
  } else {
  ?> <tr> <td colspan="5"><? echo JText::_( 'There are no sessions for this course' );?></td></tr><?php } ?>
</table>
<?php endif; ?>

<form action="<?php echo $this->action ?>" method="post" name="adminForm" id="adminForm" class="form-validate">
<?php if ( $this->params->def( 'show_page_title', 1 ) ) : ?>
<div class="componentheading<?php echo $this->params->get( 'pageclass_sfx' ); ?>">
	<?php echo $this->escape($this->params->get('page_title')); ?>
</div>
<?php endif; ?>
<table cellpadding="4" cellspacing="1" border="0" width="100%">
<tr>

<td width="15%">
	<label for="jformcourseid">
		<?php echo JText::_( 'Course' ); ?>:
	</label>
</td>
<td>
	<?php  echo $this->lists['courseid'];?>*
        
</td>
</tr>
<?php if ($_GET['hide'] == 1 ) { ?>
<tr>
       <td valign="top">
                <label for="jformcity">
                        <?php echo JText::_( 'I want to attend this course here' ); ?>:
                </label>
        </td>
        <td width="80%">


<select class="required" type="text" id="jformcountry" name="jform[country]" value="<?php echo $this->escape($this->booking->country);?>" />*
<option>Choose your Location</option>
<option>Melbourne</option>
<option>Sydney</option>
<option>Auckland</option>
</select>
        </td>
</tr>
<?php

      }


      ?>
<tr>
<td valign="top">
	<label for="jformfirstname">
		<?php echo JText::_( 'Firstname' ); ?>:
	</label>
</td>
       <td width="80%">
	<input class="required" type="text" id="jformfirstname" name="jform[firstname]" size="50" maxlength="250" value="<?php echo $this->escape($this->booking->firstname);?>" />*
</td>
</tr>
<tr>
<td valign="top">
	<label for="jformsurname">
		<?php echo JText::_( 'Surname' ); ?>:
	</label>
</td>
<td valign="top">
	<input class="required" type="text" id="jformsurname" name="jform[surname]" size="50" maxlength="250" value="<?php echo $this->escape($this->booking->surname);?>" />*
</td>
</tr>
<?php if($this->userid > 0) { ?>
<tr>
<td valign="top">
	<label for="jformusername">
		<?php echo JText::_( 'Username' ); ?>:
	</label>
</td>
<td width="80%">
    
	<input class="required" type="text" id="jformusername" name="jform[username]" size="50" maxlength="100" value="<?php echo $this->escape($this->username);?>" READONLY/>* 
</td>
</tr>
<?php } ?>

<tr>
<td valign="top">
	<label for="jformdepartment">
		<?php echo JText::_( 'Company' ); ?>:
	</label>
</td>
<td width="80%">
	<input class="inputbox" type="text" id="jformdepartment" name="jform[department]" size="50" maxlength="30" value="<?php echo $this->escape($this->booking->department);?>" />
</td>
</tr>


<tr>
<td valign="top">
	<label for="jformemail">
		<?php echo JText::_( 'Email' ); ?>:
	</label>
</td>
<td width="80%">
	<input class="validate-email" type="text" id="jformemail" name="jform[email]" size="50" maxlength="100" value="<?php echo $this->escape($this->email);?>"/>*
</td>
</tr>
<tr>
<td valign="top">
	<label for="jformphone1">
		<?php echo JText::_( 'Phone Number' ); ?>:
	</label>
</td>
<td width="80%">
	<input class="required" type="text" id="jformphone1" name="jform[phone1]" size="50" maxlength="20" value="<?php echo $this->escape($this->booking->phone1);?>" />*
</td>
</tr>

<tr>
        <td valign="top">
                <label for="jformcity">
                        <?php echo JText::_( 'Locations' ); ?>:
                </label>
        </td>
        <td width="80%">

<select type="text" id="jformcity" name="jform[city]" value="<?php echo $this->escape($this->booking->city);?>" />
<option>Choose your Location</option>
<option>Melbourne</option>
<option>Sydney</option>
<option>Auckland</option>
</select>
        </td>
</tr>
<tr>
        <td valign="top">
                <label for="jforminstitution">
                        <?php echo JText::_( 'Referral Source' ); ?>:
                </label>
        </td>
        <td width="80%">

<select type="text" id="jforminstitution" name="jform[institution]" value="<?php echo $this->escape($this->booking->institution);?>" />
<option>How did you find out about us?</option>
<option>Search Engine</option>
<option>Friends</option>
<option>Others</option>

</select>
        </td>
</tr>




<tr>
<td valign="top">
	<label for="jformdescription">
		<?php echo JText::_( 'Comments' ); ?>:
	</label>
</td>
<td>
	<textarea class="inputbox" cols="47" rows="6" id="jformdescription" name="jform[description]"><?php echo $this->escape( $this->booking->description);?></textarea>
</td>
</tr>
</table>

<div>
<button type="button" class="button validate" onclick="submitbutton('save')">
	<?php echo JText::_('Save') ?>
</button>
<button type="button" onclick="submitbutton('cancel')">
	<?php echo JText::_('Cancel') ?>
</button>
</div>

<input type="hidden" name="jform[id]" value="<?php echo $this->booking->id; ?>" />
<input type="hidden" name="jform[ordering]" value="<?php echo $this->booking->ordering; ?>" />
<input type="hidden" name="jform[approved]" value="<?php echo $this->booking->approved; ?>" />
<input type="hidden" name="jform[userid]" value="<?php echo $this->userid; ?>" />
<input type="hidden" name="option" value="com_courseman" />
<input type="hidden" name="controller" value="booking" />
<input type="hidden" name="task" value="" />
<?php echo JHTML::_( 'form.token' ); ?>
</form>
</br>
Fields marked with an asterisk (*) are required.
</br>
</br>

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.