Overall theses are awesome examples, but one problem that it didn't address is how to skip validations on a rebuild....
You can do it with an AHAH submit button with the "skip_validations" module since you can check for form_state['clicked_button'] and then skip validations only for that time.
With the dropdown since it's not a button... I can't seem to find a way to skip only on the ahah, and not on every other command like preview, and save...
and it isn't even touched upon in the AHAH examples, sure you wouldn't need it for single items.... but when you use the examples on your own form, validation bugs become a pain in the ass....
So any help would be appreciated! (especially skipping validations for dependent_dropdown !)
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | examples.ahah_example_improve_submit_handlers.patch | 6.22 KB | rfay |
Comments
Comment #1
Swayt commentedComment #2
rfayGlad you brought this up - We need to show submit handling with $form_state['rebuild'] = TRUE as well.
I don't think that in D6 you can skip validation - In D7 the #limit_validation_errors property was added for this.
Comment #3
Swayt commentedWell here's a small fix for disabling validations, after going through the AHAH helper module I managed to make a quick tweak that works. :)
ALL you need is the, skip_validations module and use the function "_skip_validation_skip_validation($form, 'full');"
to skip all validations on the AHAH components, and not affect the whole form.
You could write your own function to skip validation and not have to worry about using another module.
Comment #4
Swayt commentedComment #5
rfayThanks for your work on this.
However, to put it in "Needs Review" you need to attach a patch. I haven't fully studied your approach yet. If we put it in, it will probably be an additional example.
Comment #6
rfayI added a simple $form_state['ahah_submission'] into the ahah helper callback; that can now be checked in submit or validation handler.
Comment #7
rfayCommitted to DRUPAL-6-1, http://drupal.org/cvs?commit=425802
Thanks so much, Swayt. Would appreciate your comment on this approach.
Comment #9
Floris248 commentedSwayt you need an award for that post, seriously.
Thank you.
Comment #10
yeaha commentedthank you!
Comment #11
davepoon commentedThank you so much! That's really useful!!
Comment #12
omar alahmedThank you,
Comment #13
flamingvan commentedI discovered a pretty simple way to suppress form validation without using any contrib modules:
within your form function (the one where you specify fields)
Comment #14
Madis commentedThanks, seems to work nicely!
Comment #15
Tim_MA commentedThanks flamingvan works an absolute treat, good work!
Comment #16
Fergie commentedFlamingvan, thank you, man! I've been struggling with this for hours!