Fail on disabling cck required fields validation
msoler75 - March 17, 2009 - 16:27
| Project: | AHAH helper |
| Version: | 6.x-2.0 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Description
When I form_altering a form with cck values, inserting some ahah field, on a change event I get a validation errors in required cck fields.
I fixed this with changing this function from:
<?php
function _ahah_helper_disable_validation(&$form) {
foreach (element_children($form) as $child) {
$form[$child]['#validated'] = TRUE;
_ahah_helper_disable_validation($form[$child]);
}
}
?>To:
<?php
function _ahah_helper_disable_validation(&$form) {
foreach (element_children($form) as $child) {
$form[$child]['#validated'] = TRUE;
if(isset($form[$child]['#required']))
$form[$child]['#required'] = FALSE;
_ahah_helper_disable_validation($form[$child]);
}
}
?>It seem to works now. It's okay?
