Support

Home Forums Event Espresso Premium Making state optional or free form

Making state optional or free form

Posted: February 10, 2015 at 12:26 pm


ftdatabase

February 10, 2015 at 12:26 pm

I am using the latest release of EE4. The billing address form uses the system State field, which is a (semi-)static list of states. There is no way for users NOT to select a state. This is causing all payments to go through with “Alabama” as the state and in some cases banks rejects payments.

What is the workaround? This seems to be a rather major flaw. Can I customize the billing form so that it uses a custom, free-form State field in lieu of the system State field?


Garth

  • Support Staff

February 10, 2015 at 8:08 pm

What payment method are you using? Can you give us a link to your site so we can take a look?


ftdatabase

February 11, 2015 at 12:10 pm

We’re using authorize.net. Link is https://megado.com/registration. Thanks!


ftdatabase

February 11, 2015 at 11:30 pm

Any updates please?


Seth Shoultes

  • Support Staff

February 12, 2015 at 9:42 am

It sounds like we have a developer ticket to fix this issue. We’ll send out an update as soon as we get an update out that allows for user submitted states.

For now, you’ll have to add the countries manually in the Event Espresso > General Settings > Countries page. To make that process easier, we have some plugins you can install to populate the missing country and state data: https://github.com/eventespresso/ee-packs-states-provinces

I hope that helps.


ftdatabase

February 12, 2015 at 1:04 pm

Sorry that does not help. Having more states to choose from is nice to have, and so is having the option to let the user type in their own state name.

My problem is basically that currently the field DOES NOT LET YOU PICK A BLANK STATE. With the default set to Alabama, we are getting REJECTED transactions.

Please let me know how to address this. Even if it is a hack. This is pretty urgent. Thanks.


Seth Shoultes

  • Support Staff

February 12, 2015 at 4:16 pm

I managed to find a hack for you. If you change core/libraries/form_sections/payment_methods/EE_Billing_attendee_Info_Form to make the country and state fields text inputs which would result in this: https://docs.google.com/file/d/0B2KCao4zFjaxWG0yblA1MFVPYjQ/edit?usp=drivesdk

However, I am testing a way to change these dropdowns to text fields using filters. The fix should be released shortly.


ftdatabase

February 13, 2015 at 6:40 pm

This did the trick, thank you! I am looking forward to the permanent solution.


JackB

February 16, 2015 at 3:02 pm

I want free form state field too – so I am subscribing to this topic! Seems the “add new state if you can’t see yours” option on the checkout page has gone as well.


Visual Facilitators

February 16, 2015 at 3:35 pm

I don’t need State at all. In Europe we have countries and regions or states are not used so much.


Visual Facilitators

February 16, 2015 at 3:58 pm

Found the easiest solution, to just uncheck the state in the questions group.


JackB

February 16, 2015 at 4:08 pm

I’ve followed the hack from @seth but my state / country is still using dropdowns on the mydomain/registration-checkout/ page.

public function __construct( EE_Payment_Method $payment_method, $options_array= array()){
		$options_array['subsections'] = array_merge(
			array(
				'first_name' 	=> new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn' )),
				'last_name'		=> new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn' )),
				'email'			=> new EE_Email_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn' )),
				'address'		=> new EE_Text_Input( array( 'html_label_text'=>  __( 'Address', 'event_espresso'), 'required'=>TRUE, 'html_class' => 'ee-billing-qstn' )),
				'address2'		=> new EE_Text_Input( array( 'html_label_text'=> __( 'Address 2', 'event_espresso'), 'html_class' => 'ee-billing-qstn' )),
				'city'			=> new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn' )),
				'state' 		=> new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn' )),
				'country' 		=> new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn' )),
				'zip'			=> new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn' )),
				'phone'			=> new EE_Text_Input( array( 'html_class' => 'ee-billing-qstn' )),
			),
			isset( $options_array['subsections'] ) ? $options_array['subsections'] : array()
		);

Is there another step required to get this working right?


Josh

  • Support Staff

February 16, 2015 at 7:33 pm

Hi Jack,

It turns out that the hack that Seth posted is for the billing info fields for the credit card form on the payments page. It does not affect the registration form fields.


JackB

February 16, 2015 at 7:56 pm

OK – thanks for your help. I understand there is an update coming out 4.6.7 that will address this issue. I am eagerly awaiting as at the moment customers are unable to register for our imminent event.


Lorenzo Orlando Caum

  • Support Staff

February 17, 2015 at 10:19 am

Hi, please go ahead and update to Event Espresso 4.6.8. You can view the change log for that version here:

https://eventespresso.com/wiki/ee4-changelog/


Lorenzo


JackB

February 17, 2015 at 1:58 pm

Thanks – I don’t see any update through WP Plugins update screen. Is this gonna have to be a manual update?


JackB

February 17, 2015 at 9:32 pm

Hi

I’ve now updated to 4.6.9 but can’t see any way to make state (or even country) optional as a text field.

Also, the “Add new state” link is still missing from the registration page?

What’s going on!


Dean

February 18, 2015 at 2:54 am

Hi,

Their isn’t an option, it’s a filter. If you add the following to a site specific plugin (https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/) it will change the dropdown to a required text field. If you change the true to false, it will show a field that is not required so can be left blank.

add_filter( 'FHEE__EE_Billing_Attendee_Info_Form__state_field', 'state_text_field', 10, 1 );
function state_text_field( $original_field ) {
    return new EE_Text_Input( array( 'required' => true, 'html_class' => 'ee-billing-qstn'));
}

Please note this only works for payment billing questions, not the standard address question.


JackB

February 18, 2015 at 5:03 am

Well that’s great, thank you – but it doesn’t help me – I need a hack or a fix to be able to make state (and country) text fields on the REGISTRATION checkout form – I don’t want any dropdown – just a simple text field for both.

Please tell me how best to achieve this.

Also, the “Add new state” link is still missing from the registration page.


Dean

February 18, 2015 at 5:27 am

Hi,

I can make a request for filters to be added for those in future releases, though I cannot guarantee inclusion.

Please note, it is best if you start your own forum thread unless your query exactly matches that of the original person who created the forum thread. This helps reduce and even stop confusion within a support thread.

The support post ‘Making state optional or free form’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso