Events Made Easy Forums How do I … Default Value of Registration Form Fields?

Viewing 32 posts - 1 through 32 (of 32 total)
  • Author
    Posts
  • #55930
    Anonymous
    Inactive

    When using custom Registration form fields is there a way to prefill the field value when setting up the form? for example in the code below how can we preset the value of field18? Note that we are not able to do this via query parameters. We want to embed in the form.
    <div class=”medium-6 column”>
    <label>Campaign Member Status
    #_FIELD{18}</label>
    </div>

    #55931
    Franky
    Keymaster

    For text and textarea you can use the “field tags” part to set a default value (not documented, I really should do that …)

    #55938
    Anonymous
    Inactive

    Can you elaborate how to use the field tags? syntax?

    #59476
    Anonymous
    Inactive

    Bumping this thread.

    OP was asking if it’s possible to define a value for a Custom Field in an EME form. I have the same question. Seems like an oversight if it’s not possible, as this would be a major restriction on the usage of EME Custom Fields.

    Franky, your comment on this thread was answering a different question, which is how to set a default value for Custom Fields. (Admittedly, the title of the thread makes it sound like that was OP’s question.) This is valuable information as well and it’s not clear what “Field Tags” even are, much less how to use them. You really need a documentation page for Custom Fields – it’s all guesswork based on tangential forum posts for us users.

    #59477
    Franky
    Keymaster

    Setting a default value for custom fields per event can be achieved using a filter. See
    https://www.e-dynamics.be/wordpress/category/documentation/12-hooks-and-filters/
    The filter to use: eme_field_value_filter (simple example included too)

    Concerning field “tags”, it is explained already in the definition, but I’ll extend a bit in the next version.

    Concerning doc in general: I’m always open to accept proposed changes 🙂

    #59496
    Anonymous
    Inactive

    I would like to use a Custom Field in a membership form. Can I set a value for it per membership?

    #59497
    Franky
    Keymaster

    You can use a value different from others, but then you’ll need to detect the membership being used. Currently that is not as easy as it seems. So if you want a different default value per membership, use a different field. And default values can be set in the definition of the field, the mentioned filter above is if you need to check info based on external factors (logged in user, other database, …).

    #59508
    Anonymous
    Inactive

    Thanks, Franky.

    Using different Custom Fields for each membership will not work for my purposes, since I want to use the Placeholder for the Custom Field in the (global) “Payment membership success return page format” setting.

    Basically, I just want to insert a membership-specific folder name into a URL in these settings so that I can send new members along to a page with events that only apply to that membership.

    Since I can’t set the value of a (hidden) Custom Field using a normal Custom Field placeholder in a membership form, is eme_field_value_filter the only way to achieve this?

    I am not a PHP master. Does the filter just go in my functions.php?

    #59509
    Franky
    Keymaster

    The filter indeed goes in your functions.php
    But I guess the simple solution would be if I allowed the global setting “Payment membership success return page format” also to be set per membership. Would solve the problem I guess 🙂
    Or the other method would be if I also allow custom fields per membership (like I do for events). I think both are nice to have …

    #59510
    Anonymous
    Inactive

    Thank you as always Franky!

    I think the best solution for users would be to add the ability to define a value for a Custom Field at the point of insertion into an EME Template! The reason I think it’s the best is it adds the most power to EME for customization. It could be used in all sorts of interesting and creative ways.

    Something like this:

    #_FIELD{xxx}[‘membership-slug’]

    Would such a feature be difficult/complex to build?

    #59511
    Franky
    Keymaster

    I’ve already coded up the 2 things I mentioned above, just need to test them (and make sure nothing interferes with e.g. custom fields for members)

    #59512
    Anonymous
    Inactive

    Awesome, thanks F! Custom fields for membership forms especially will be very powerful!

    #59513
    Franky
    Keymaster

    It is not for membership “forms” (the form being the membership subscription form), but if you mean the membership defnitition form: yes, I’ll hope it helps.

    #59514
    Anonymous
    Inactive

    Ah yes, I meant Custom Fields defined per membership that can of course be used in Membership Form Templates.

    #59515
    Franky
    Keymaster

    Well, the code is ready for testing. So if you feel up for it …

    #59516
    Anonymous
    Inactive

    Sure, I’ll give it a shot. Care to shoot me a commit link here so I can throw in the new additions on my end?

    #59517
    Franky
    Keymaster

    I was going to point you to the wordpress dev-version, but unfortunately wordpress has temporary closed the plugin due to some security concerns. I’m clearing up these concerns with them.
    One was the option of allowing the email certificate for mailservers to be ignored, which is valid in fact but I’ve added more restrictions to it in the next version.
    The other one is related to file uploads (where I use the php function mime_content_type to check the allowed mime type, but apparently it is very easy bypassed since it just checks the first bits in a file, sigh) WordPress itself has an extra function that checks if the detected mimetype and extension match too, so I’ve added that to the code.
    So I hope they’ll release the plugin again soon (but it can take days for them to revalidate a plugin).

    #59519
    Anonymous
    Inactive

    Ok thanks for the update! Good luck jumping through their hoops.

    #59521
    Franky
    Keymaster

    Well, I got the news the plugin is re-listed, so that’s good.
    However, in order to get there, I did need to tune a *lot* of stuff the wp-way, so I hope I didn’t break anything 🙂
    So don’t just update in production, but try out the new version in dev.

    #59529
    Anonymous
    Inactive

    Okay, I downloaded the latest tagged version of EME and am testing it out.

    I made a template for the Member Added message and assigned it for my Membership. I haven’t tested it (since purchases are live) but I assume it should work fine for the purposes of this thread. Thanks!

    Meanwhile I tested the Custom Fields tab in my Membership (just to see how it functions) but wasn’t able to get it to work. I made a new Members Custom Field (type hidden) and wanted to see if it would show up in the Membership Custom Fields tab, but it’s totally blank:

    Membership Custom Fields tab

    #59531
    Franky
    Keymaster

    Yeah, type hidden won’t show much now, would it (and it needs to be of type membership)?

    #59534
    Anonymous
    Inactive

    I thought that I would be able to set a Membership-specific value for custom fields from that Custom Fields tab view. Is that incorrect?

    #59536
    Franky
    Keymaster

    Well, that is the case: custom fields of type “membership” help in the definition of the membership. But it is what it is: a field of type “hidden” will be hidden.
    There is in fact no use at all for that type in the definition of the membership: how would you be able to change the value?
    I’ll remove that type for memberships/events/locations next time, so it won’t be possible anymore.
    Just use regular fields (dropdown, text, …).
    Don’t forgot: the field is used for defining memberships, not members. The only use you have for that field is showing its value (like you can do with the price) to the member.

    See also this text when creating a custom field:
    If you select ‘Events field’, ‘Locations field’ or ‘Memberships field’, this field will be used in the definition of the event, location or membership. Warning: this is unrelated to the use of custom fields in RSVP forms, so if you don’t intend to use this field in the definition of events, locations or memberships, don’t select this.

    #59559
    Anonymous
    Inactive

    Well, this was originally to create a field that can be used in membership settings globally, but have a different value for each membership. (In my case it was just the success message, which you added manually as a template slot, but it could be for other settings such as failure, right?)

    The only place to save such a value is in the member’s data, right? So such a field would have the same value for every member of a particular membership and the member would not need to see the field in the signup form – hence, a hidden field defined by the admin.

    #59560
    Franky
    Keymaster

    You’re confusing a field for members with a field for memberships.
    The field is defined in “custom fields” with all possible options, and has a value you choose when you define the membership. For members you can then just show that value in the success message (using #_FIELD{xxx} for example)

    #59561
    Anonymous
    Inactive

    Oh I think I understand now. I have used Custom Fields in Events and they work the same way (each Event gets a unique value for each Field if desired).

    But I was able to use hidden fields in Events to function as I intended to use with Memberships. Why can I do hidden with Events but not Memberships?

    #59562
    Franky
    Keymaster

    Like I said: there’s no point in defining a hidden field which value can’t be changed interactively (because it is hidden). The only use of a hidden field is in fact that you can change the value using a filter (in e.g. the rsvp form) without letting the user see the value as to not overload the form.
    If you want to e.g. define a certain url for each membership, you’d use a text field so you can enter the url when defining the membership.

    #59566
    Anonymous
    Inactive

    Oh I see. The custom field is for admin use only – it allows the admin to define things in WP admin that are specific to given memberships. Gotcha!

    I see there is a new custom field type “Membership Field” in the dropdown too. This is exactly what I was asking for, well done. Sorry it took me a moment to understand.

    #59567
    Anonymous
    Inactive

    Can I use the ID for the membership custom field in the Payment Success message setting like this?

    <h4 style="text-align: center">Thank you so much for joining #_MEMBERSHIPNAME!</h4>
    <div style="text-align: center"><a href="/festivals/#_FIELD{7}/events"><button style="padding-left: 2%;padding-right: 2%"><h5>Book your event tickets now</h5></button></a></div>
    #59605
    Anonymous
    Inactive

    ping

    #59606
    Franky
    Keymaster

    Well, yes 🙂

    #59608
    Anonymous
    Inactive

    Thank you!!

Viewing 32 posts - 1 through 32 (of 32 total)
  • The forum ‘How do I …’ is closed to new topics and replies.
Scroll to Top