Forums

input error pop up not working

Dudley Morrown 16 Dec, 2011
Have created a new form and only just realized that when there is an error it does not pop up the usual error message when hitting submit, the form has to load the &event=submit page before it then shows the error via the Joomla error message announcement.

On all the other forms the error pop up works and as far as i can see all the settings are the same as the other forms, apart the other forms were created in an earlier version of Chrono and were carried over when i upgraded it.

The form does work in all the other areas and submits properly if there are no errors.

This is the form HTML CODE

<?php
if ( !$mainframe->isSite() ) { return; }
/*
 function to generate a random alpha-numeric code
 using a specified pattern
 *
 * @param $pattern string
 * @return string
 */
function generateIdent($pattern='AA9999A')
{
  $alpha = array("A","B","C","D","E","F","G","H",
    "J","K","L","M","N","P","Q","R","S","T","U","V","W",
    "X","Y","Z");
  $digit = array("1","2","3","4","5","6","7","8","9");
  $return = "";
  $pattern_array = str_split($pattern, 1);
  foreach ( $pattern_array as $v ) {
    if ( is_numeric($v) ) {
      $return .= $digit[array_rand($digit)];
    } elseif ( in_array(strtoupper($v), $alpha) ) {
      $return .= $alpha[array_rand($alpha)];
    } else {
      $return .= " ";
    }
  }
  return $return;
}
?>
<?php
$ident = generateIdent();
?>
<input type='hidden' name='ident' id='ident'
  value='<?php echo $ident; ?>' />
<div class="ccms_form_element cfdiv_header" id="_h1_actsco_printing_2012_daily_planner_h1___container_div"><h1>Daily Planner</h1><div class="clear"></div></div>
<p><span style="font-family: tahoma, arial, helvetica, sans-serif; font-size: small;">text here</span></p>
<p></p>
<div class="ccms_form_element cfdiv_text" id="full_name_container_div"><label>Full Name</label><input maxlength="150" size="30" class=" validate['required']" title="" label_over="0" hide_label="0" type="text" value="" name="input_name" />
<div class="clear"></div><div id="error-message-input_name"></div></div><div class="ccms_form_element cfdiv_text" id="email_address_container_div"><label>Email Address</label><input maxlength="150" size="30" class=" validate['required','email']" title="" label_over="0" hide_label="0" type="text" value="" name="input_email" />
<div class="clear"></div><div id="error-message-input_email"></div></div><div class="ccms_form_element cfdiv_text" id="phone_number_container_div"><label>Phone Number</label><input maxlength="150" size="30" class=" validate['required','phone']" title="" label_over="0" hide_label="0" type="text" value="" name="input_phone" />
<div class="clear"></div><div id="error-message-input_phone"></div></div><div class="ccms_form_element cfdiv_textarea" id="shipping_address_container_div"><label>Shipping Address</label><textarea cols="45" rows="12" class=" validate['required']" title="" label_over="0" hide_label="0" type="textarea" name="input_shipping_address"></textarea>
<div class="clear"></div><div id="error-message-input_shipping_address"></div></div><table border="0" class="mceItemTable"><tbody><tr><td><div class="ccms_form_element cfdiv_text" id="how_many_would_you_like_container_div"><label>How many would you like</label><input id="input_copies" maxlength="150" size=20" class=" validate['required','number']" title="" label_over="0" hide_label="0" type="text" value="" name="input_copies" />
<div class="clear"></div><div id="error-message-input_copies"></div></div></td><td><div class="ccms_form_element cfdiv_text" id="to_pay__container_div"><label>To Pay...</label><input id="amount" maxlength="150" size="5" class="" title="" label_over="0" hide_label="0" type="text" value="" name="amount" /><div class="clear"></div><div id="error-message-amount"></div></div></td></tr></tbody></table><div class="ccms_form_element cfdiv_text" id="please_enter_captcha_container_div"><label>Please enter Captcha</label><input maxlength="150" size="17" class="chrono_captcha_input validate['required']" title="" type="text" value="" name="chrono_verification" />
{chronocaptcha_img}<div class="clear"></div><div id="error-message-chrono_verification"></div></div><div class="ccms_form_element cfdiv_submit" id="input_submit_6_container_div"><input name="input_submit_6" class="" value="Submit" type="submit" />
<div class="clear"></div><div id="error-message-input_submit_6"></div></div>


Is this because of the HTML or a bug due to added JS code? Any help will be appreciated!
GreyHead 16 Dec, 2011
Hi Dudley,

Missing validation messages are usually a sign of a JavaScript error that won't be apparent from the Form HTML. What errors do you see if you use the Web Developer tools in your browser?

Bob

PS You can remove this line - it was only needed for one older version of CFv3:
if ( !$mainframe->isSite() ) { return; }
Dudley Morrown 20 Dec, 2011
hi bob,

does this look like a related error? attached a screen shot of the error...
GreyHead 20 Dec, 2011
Hi Dudley,

That looks like the kind of error that will break the validation. Please post a link to the form so I can take a quick look.

Bob
Dudley Morrown 09 Jan, 2012
Hi Bob Happy New Year!

I only am now getting back to work and will hopefully fix the form error here is the link to the form: ************-daily-planner-2012


Dudley
GreyHead 09 Jan, 2012
Hi Dudley,

The Submit button needs to have an id of 'submit'; that solves the immediate error that I see. But I suspect that the replaceable labels code may have some other bugs with MooTools v1.3/1.4. Please test and let me know. It's on my to-do list . . . but the list is long :-(

Bob
Dudley Morrown 09 Jan, 2012
Hey Bob,

That was it THANKS AGAIN! i feel a little embarrassed as i was looking at that code for hours and the error but could not figure this simple error out. It just shows debugging is more than just reading the errors.

And yes the LIST don't start i think i have several lists and only today received an email from a client reminding me of a list i had completely forgotten about.

We will get there in the end.
This topic is locked and no more replies can be posted.