It seems that with no javascript enabled the ahah_helper_generic_submit callback tries to validate fields prior to updating the ahah-wrapper. So an error message is being printed first and the ahah-form fields don't get updated at all.

CommentFileSizeAuthor
#1 Clipboard01.jpg37.8 KBdrupov

Comments

drupov’s picture

StatusFileSize
new37.8 KB

Here's a screenshot from the demo module... The "usage" select list is being set to "private" and the validation messages pop-up. "Company name:" and "VAT number" are not replaced by "First name", "Last name" etc.

a_c_m’s picture

+1 on this, been looking at the other solutions / reports. So far none work.

a_c_m’s picture

So the solution is basically to use the skip_validation module.

http://drupal.org/project/skip_validation

Which makes everything work as you would expect. Part of me would like to see ahah_helper make skip validate a dependancy.

e.g.

  $form['billing_info']['update_usage'] = array(
    '#type'  => 'submit',
    '#value' => t('Update usage'),
    // Note that we can simply use the generic submit callback provided by the
    // ahah_helper module here!
    // All it does, is set $form_state['rebuild'] = TRUE.
    '#submit' => array('ahah_helper_generic_submit'),
    // We set the 'no-js' class, which means this submit button will be hidden
    // automatically by Drupal if JS is enabled.
    '#attributes' => array('class' => 'no-js'),
    // Skip valdation if this button is used as a full form submit
    '#skip_validation' =>  TRUE,
  ); 
nunoveloso’s picture

Hi,

I've followed the same appraoch as a_c_m in #3 but setting

'#skip_validation' =>  TRUE

might produce unexpected submission results, use it with care! Basically it's good to use on DELETE buttons (where you actually don't submit anything but just redirect the user to a confirmation page).


Instead, simply use:

'#skip_required_validation' =>  TRUE

(more info in this here: http://drupal.org/node/602914#comment-2143636)


Also, I am +1 for having skip_validation as a dependency of this module.

Nuno

peter.hellerhoff’s picture

Category: bug » support

skip_validation does not seem to work with CCK fields. I have tried both, '#skip_required_validation' => TRUE and '#skip_validation' => TRUE with no effect.
Can anybody confirm this. Is there a solution for CCK fields?