For a user that has signed up through the drupal register interface (as opposed to Ecommoerce, checkout or ec_anon), address module prints a form in checkout with a country selector at the top.
The State/Province field is not marked with * as required, however if it is left blank, drupal returns the message: Please enter a state/province/region.
See screenshot
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | module_4.patch | 2.23 KB | brmassa |
| #6 | javascript.patch | 1.97 KB | brmassa |
| screenshot_34.png | 251.47 KB | Bevan |
Comments
Comment #1
Bevan commentedrelated to: http://drupal.org/node/121359
Comment #2
gordon commentedThis is a issue with the formapi. These fields are not required but at least 1 needs to have data in it.
Comment #3
Bevan commentedwhich fields are "these fields"? Please see the screenshot -- i'm not sure if you understood the issue. but then I'm not sure if I understand your explanaition either.
Comment #4
gordon commentedProvince/Region and state are 2 separate fields, and only it only needs 1 field to be populated to be a valid form.
In your image the state field is hidden but it is there.
In the formapi which generates all the forms in Drupal the is no way to add the red * with having the 2 fields being required.
Comment #5
elio commentedFlexycharge doesn't work with anon_address, is it a bug? I use flexycharge to shipping cost and buying a with ec_anon will charge the defaut.
It's very bad, makes ec_anon uneusable.... can I contribute?
Comment #6
brmassa commentedGordon and Bevan,
there is a attribute called "#DANGEROUS_SKIP_CHECK" that permits changing the field using javascript. so i created a patch that instead using "state" and "province" fields, the javascript replace entirelly a input for a select field.
it goes further than the patch i created on http://drupal.org/node/135477.
best regards,
massa
PS: state is considered required despite many users asking for not.
Comment #7
brmassa commentedand the .module patch
Comment #8
Bevan commentedCool! I actually ditched user-registration in favor of ec_anon for this project. Does this patch apply to ec_anon also? Can you provide a screenshot please?
tks
Comment #9
gordon commentedI am not going to go any further with this. The proposed fix is just over blown just to be able to add a red *
This is something that is just not available in the current Drupal formapi.
Comment #10
brmassa commented@ Bevan,
The general appearence is exactly the same as before.
I dont use ec_anon. But it corrects all Address creating/editing forms. It might work.
@ Gordon,
i think you underestimated the patch: it corrects 3 BUGS and add 1 FEATURE!
As i said before, i believe that making state a required field is not right, since some countries dont have states or provinces. Its is a undesirable feature. but since its is required, it is a interface BUG. I suggest you simple delete the
"#require" => trueline.I know the solution is not elegant, but i believe that somewhat ugly code is better than a buggy code.
FormAPI provides the "#DANGEROUS_SKIP_CHECK" attribute for exactly these sittuations where fields should be dynamically created. There are some modules that use the same tech, including dynamic address (!!), like http://drupal.org/node/102294.
best regards,
massa
Comment #11
gordon commentedYes maybe but this cannot be ported to the 4.7 version, and we are redeveloping all this for v4 so it is not needed.
Comment #12
kingandyThe address.module includes a check for a variable named 'store_ignore_state' but this does not appear to be configurable anywhere.
I'm given to understand that since hook_settings was removed for 5.0 this would require manual creation of a menu callback, doing something like the following:
Then something like this needs to be added to the address_menu function:
I'm not terribly familiar with the new module settings system but hopefully that will point somebody more experienced in the right direction.
Additionally, the following lines could be added to the
address_form_fields()function:... but I'm even less knowledgeable of the innards of the ecomm system than I am of the module config system, so that might not be idea.
Hope that helps.