News:

Looking for documentation? Take a look on our wiki

Main Menu

State / Province / Region * required field is not working

Started by concap, February 14, 2013, 04:36:07 AM

Previous topic - Next topic

concap

G'day,
when filling up billing address information, condition for required field 'State / Province / Region' is skipped. Which means that when customer leaves 'State / Province / Region' on default value = -Select- then Customer is not notified about required field and form gets saved.

I've checked that Configuration->shoper fields virtuemart_state_id Required is checked.
Joomla2.5.9 VM2.0.18a

Anybody knows what is wrong?

jetdeck


dhefley

Same here; I thought it was an IE thing, but it isn't...just started happening with upgrade to 2.0.18a

PRO


dhefley

It seems to me it works on mine, partly, as well (with our without template overrides, but that was a good suggestion!).  *If* I put in my address, and select a Country with State/Prov/Region as my first selection, it requires me to pick a state.  However, if I pick a country without one (like by typing in the select, just selecting) and then pick a country with a state, it then does not validate.

Here is how I reproduce:
Using CHROME:
Go to <site>/products/user/editaddresscartBT

Step 1:
Fill all fields with "Test"
Select Angola from Country
Select United States from Country
Click on Checkout as Guest
It saves and returns to cart screen

Step 2:
If I now click on Add/Edit Billing Address
It shows United States as country, -- Select -- from State
If I click on "Checkout as Guest", it tool tips the "Please Select an Item in the List" for state, but then the form submits anyway and returns to cart screen

Step 3:
If I now click on Add/Edit Billing Address
Change Country to -- Select --, it won't let me submit with an alert of  "Required Field Missing"
Pick United States, and the tool tip "Please Select an Item in the List" for state comes up again, but, once again, the form submits anyway.


If I try this in Firefox:
Step 1 behaves the same.
Step 2 and 3: I get the tool tip on the State select, but the form DOES NOT submit now...

If I try this in IE9:
Step 1: Even if I select United States first, it immediately allows form submission.
Step 2 and 3: No tooltip, just submits form, regardless of status of Country or State...

concap


PRO

Quote from: dhefley on February 21, 2013, 16:31:40 PM
It seems to me it works on mine, partly, as well (with our without template overrides, but that was a good suggestion!).  *If* I put in my address, and select a Country with State/Prov/Region as my first selection, it requires me to pick a state.  However, if I pick a country without one (like by typing in the select, just selecting) and then pick a country with a state, it then does not validate.

Here is how I reproduce:
Using CHROME:
Go to <site>/products/user/editaddresscartBT

Step 1:
Fill all fields with "Test"
Select Angola from Country
Select United States from Country
Click on Checkout as Guest
It saves and returns to cart screen

Step 2:
If I now click on Add/Edit Billing Address
It shows United States as country, -- Select -- from State
If I click on "Checkout as Guest", it tool tips the "Please Select an Item in the List" for state, but then the form submits anyway and returns to cart screen

Step 3:
If I now click on Add/Edit Billing Address
Change Country to -- Select --, it won't let me submit with an alert of  "Required Field Missing"
Pick United States, and the tool tip "Please Select an Item in the List" for state comes up again, but, once again, the form submits anyway.


If I try this in Firefox:
Step 1 behaves the same.
Step 2 and 3: I get the tool tip on the State select, but the form DOES NOT submit now...

If I try this in IE9:
Step 1: Even if I select United States first, it immediately allows form submission.
Step 2 and 3: No tooltip, just submits form, regardless of status of Country or State...


do you use more than 1 country?

I know the newest vmart you can choose a "default" USA and the states will be filled.


concap

Default country is set to Australia if it makes any difference.

PRO


concap

What would be the template which overwrites particular file?

PRO


Akarr

Quote from: concap on February 14, 2013, 04:36:07 AM
G'day,
when filling up billing address information, condition for required field 'State / Province / Region' is skipped. Which means that when customer leaves 'State / Province / Region' on default value = -Select- then Customer is not notified about required field and form gets saved.

I've checked that Configuration->shoper fields virtuemart_state_id Required is checked.
Joomla2.5.9 VM2.0.18a

Anybody knows what is wrong?

in shopper field list disable the virtuemart_state_id and that should do the trick. if your shop is outside US and dont need the US states

forprobe

and if I have only US with its states? what is the solution?

PRO

Quote from: forprobe on June 12, 2013, 22:27:59 PM
and if I have only US with its states? what is the solution?

what is your exact problem?

& are you using the newest version?

ChrisTDR

Here's a solution that may solve some people's problems. I am using a template, that does not have any over-riding files for User.

I found that in components/com_virtuemart/views/user/tmpl/edit_address.php - there is a section that reads:

function callValidatorForRegister(f){

        var elem = jQuery('#username_field');
        elem.attr('class', "required");

        var elem = jQuery('#name_field');
        elem.attr('class', "required");

        var elem = jQuery('#password_field');
        elem.attr('class', "required");

        var elem = jQuery('#password2_field');
        elem.attr('class', "required");

        var elem = jQuery('#userForm');


The last line containing: #userForm appears to attempt to validate the whole userform (the fields below Username and Password)

I changed this to name each field individually like this:

function callValidatorForRegister(f){

        var elem = jQuery('#username_field');
        elem.attr('class', "required");

        var elem = jQuery('#name_field');
        elem.attr('class', "required");

        var elem = jQuery('#password_field');
        elem.attr('class', "required");

        var elem = jQuery('#password2_field');
        elem.attr('class', "required");

        var elem = jQuery('#first_name');
elem.attr('class', "required");

var elem = jQuery('#last_name');
elem.attr('class', "required");

var elem = jQuery('#address_1');
elem.attr('class', "required");

var elem = jQuery('#zip');
elem.attr('class', "required");

var elem = jQuery('#city');
elem.attr('class', "required");

var elem = jQuery('#virtuemart_country_id');
elem.attr('class', "required");

var elem = jQuery('#virtuemart_state_id');
elem.attr('class', "required");


(you may be using more fields that this - the field names can be found in the 'Shopper Fields' configuration area of the backend) - just start each with '#'

This works for me, I know this because when I click 'Register' on an empty form, all the required fields that have validation appear with a yellow highlight and this now includes the State field.

Hope this helps people.
Regards

Chris