Support

Home Forums Event Espresso Premium Registration Form – how to add javascript?

Registration Form – how to add javascript?

Posted: April 4, 2020 at 10:44 am

Viewing 2 reply threads


vsme

April 4, 2020 at 10:44 am

I have an event where a minimum of 2 tickets must be purchased for each registration.

There is one field for the primary to enter a “group name” that is applicable to each additional attendee in the group. Submitting the registration only ties the “group name” to the primary attendee though, and not all the additional attendees. I require the same “group name” to apply for each additional attendee.

So, I have added the “group name” form field for additional attendees to answer also. However, the “group name” for each attendee in one registration must be identical. Thus, I am considering using javascript to disable the field for additional attendees and populate it with whatever “group name” is for the primary attendee. I am not sure about the proper way to do this though. Is there a hook to tap into that is appropriate for this? Do I need to find the registration template and add javscript into it? Is there a simpler way to simply tell EE to take group name from the primary attendee and apply it to each additional attendee?

Thanks in advance.


vsme

April 4, 2020 at 11:12 am

sorry ignore this topic, i can work with this
https://gist.github.com/joshfeck/86a93df2cddfa7efba7427e66ab0b22b


Tony

  • Support Staff

April 6, 2020 at 3:40 am

Hi there,

Although you’ve mentioned you can use the above, I have a couple of snippets that may help here.

First, this one: https://gist.github.com/Pebblo/f27056f2bcf220f5d391

That currently targets the ’email’ fields and leaves only the first for the primary registrant, then copies the value entered into all others (essentially the same as what you are asking for only a different field).

Or, there is also this: https://github.com/eventespresso/ee-code-snippet-library/blob/master/admin/registration-reports/core/tw_ee_populate_additional_registrants_questions_using_primary_reg.php

Which uses the ‘Primary Registrant’ answer for any questions that don’t have an answer on the additional registrants when you export the CSV. This is a little different in that it doesn’t ‘set’ a value on the question, it’s simply using the value from the primary for all and only does so on the CSV so may not work for you depending on your use case.

Just thought I’d add those incase they are of use for you.

Viewing 2 reply threads

The support post ‘Registration Form – how to add javascript?’ 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