Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I am using shs on profile2 form. If form validation fails and an error is shown shs js(ajax) wont load the select list and it will be hidden by css. If there is no error after form is submited then shs is working well. Thx
Comment | File | Size | Author |
---|---|---|---|
#5 | if_form_error_occurs-2151747-5.patch | 628 bytes | -enzo- |
Comments
Comment #1
stBorchertI tried with latest version of Drupal (7.24), SHS (7.x-1.x-dev) and Profile2 (7.x-1.3) and its working as expected.
If I (for example) leave field "username" empty and sumbit the form, Drupal reports the error "Username field is required." and the SHS-field is loaded as expected.
Do you have any special configuration or other modules that may cause Javascript errors so SHS won't load the field?
Comment #2
doppel CreditAttribution: doppel commentedThis happens to me when having 2 SHS select list, When the form is submitted and returns a validation error the 2nd select list disappears.
Note: I'm using Entityform (7.x-1.4)
Comment #3
-enzo- CreditAttribution: -enzo- commentedI have the same issue with version 7.x-1.6+34-dev
Comment #4
stBorchertCan anyone experiencing this issue please write down his configuration (used modules, widget settings, etc., )? I couldn't reproduce this.
Comment #5
-enzo- CreditAttribution: -enzo- commentedHi @stBorchert
I found and fix the problem.
The problem occurs when you have a field configured as required, but in the form you don't select anything and submit save button of node, the submit process fail and the select is gone.
That is because a logic in widget for SHS in shs_field_widget_afterbuild, the logic don't handle the submit error fail and execute some code disabling parent information in shs js settings.
Attached you can find a patch to fix the module, please validate the value _none, I don't know if is just in my environment.
If you can't wait until this fix is applied by maintainer, imagine you have a module name YOURMODULE, then just copy the following module and all will be fixed.
AGAIN CHECK THE DEFAULT VALUE IF IS _none OR OTHER.
Comment #7
stBorchertThanks for your patch, I've committed it to the latest dev.
Even if I couldn't reproduce this behavior the patch makes sense and doesn't break things ;)
Hope this fixes the problem described here ...