Page 1 of 1

State on user registration form

Posted: Fri Feb 11, 2022 8:18 am
by solarsurfer
Hi
In the user registration form, the country can be selected from a drop down list.

The drop down list does not show in the "state" field, and reports an error saying "please select from list".

How do I change the state field to show that there is a list to select from, and maybe add "select from list" as the default field entry in the box ?

How can I make the field in "country" to default to "UK" if it is the only field entry anyway ?

Re: State on user registration form

Posted: Fri Feb 11, 2022 8:23 am
by heatherbell
solarsurfer wrote: Fri Feb 11, 2022 8:18 am Hi
In the user registration form, the country can be selected from a drop down list.

The drop down list does not show in the "state" field, and reports an error saying "please select from list".

How do I change the state field to show that there is a list to select from, and maybe add "select from list" as the default field entry in the box ?

How can I make the field in "country" to default to "UK" if it is the only field entry anyway ?
This addon might help - app.php/addons/supporters_code/s03e08_c ... _selector/
Seen in demo here - https://template.me.uk/PRO/S3/create_account.php

Re: State on user registration form

Posted: Fri Feb 11, 2022 3:36 pm
by 14Steve14
Do you have all the relevant states set up on your site so they can be shown.

Re: State on user registration form

Posted: Fri Feb 11, 2022 3:47 pm
by heatherbell
solarsurfer wrote: Fri Feb 11, 2022 8:18 am How can I make the field in "country" to default to "UK" if it is the only field entry anyway ?
Is UK the only country to which you deliver?
In which case, maybe the State Customer Data module (which I guess you would be using for UK counties) would not be required as counties are no longer required for delivery addresses in UK anyway.

Re: State on user registration form

Posted: Sat Feb 12, 2022 10:43 am
by solarsurfer
Hi
Can someone please tell me which php file processes the "user registration" form and sends the data to the sql tables and I can amend the php to get it running right ?

Thanks in advance

Re: State on user registration form

Posted: Sat Feb 12, 2022 12:39 pm
by Kofod95
solarsurfer wrote: Sat Feb 12, 2022 10:43 am Hi
Can someone please tell me which php file processes the "user registration" form and sends the data to the sql tables and I can amend the php to get it running right ?

Thanks in advance
I think here: https://github.com/CE-PhoenixCart/Phoen ... _state.php

In which case it's even better: You can just make a new module to do what you want.
There are in fact not many cases in which you need to amend the core files.

//Daniel

Re: State on user registration form

Posted: Thu Apr 27, 2023 10:20 am
by superche
Hi guys, so this should be an easy fix on the first attempt the user does not get a drop download list for state
first go.png
But if you put something in wrong or make a spelling mistake, the drop-down is offered to you?
And I also get the error displayed twice to me
attempt 2.png
attempt2a.png
Questions
1. How do I have the dropdown offered the first time round
2. Why is the user being presented with 2 lines show the error

Thanks Troy

Re: State on user registration form

Posted: Thu Apr 27, 2023 12:45 pm
by superche
Thank you all,
This has been resolved with an add-on Country State Selector

Re: State on user registration form

Posted: Tue May 02, 2023 8:34 am
by burt
For those having a similar issue in the future;

The states dropdown depends solely on the country dropdown, and whether the selected country has "zones" set up. As an example:

USA would have 50 or so zones (california, wyoming, florida etc).
Australia would have 10 or so zones (western australia, queensland etc).

At the point of registration when the create_account page loads, there is no easy way to know which country the user is from, therefore there is no way to know to load the correct states dropdown.

This means another way must be found to load the states after the country is selected (if you do not like the basic behaviour of Phoenix [reload page asking user to select from list]), which in this case can be done with some javascript (one of which is the PRO addon mentioned above).