Events Made Easy › Forums › How do I … › Default Value of Registration Form Fields?
- This topic has 31 replies, 3 voices, and was last updated 5 years, 9 months ago by Anonymous.
-
AuthorPosts
-
Tue 10 Jan 2017 at 19:32 #55930AnonymousInactive
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>Wed 11 Jan 2017 at 11:59 #55931FrankyKeymasterFor text and textarea you can use the “field tags” part to set a default value (not documented, I really should do that …)
Thu 12 Jan 2017 at 03:23 #55938AnonymousInactiveCan you elaborate how to use the field tags? syntax?
Wed 23 Jan 2019 at 21:20 #59476AnonymousInactiveBumping 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.
Wed 23 Jan 2019 at 23:11 #59477FrankyKeymasterSetting 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 🙂
Fri 25 Jan 2019 at 22:47 #59496AnonymousInactiveI would like to use a Custom Field in a membership form. Can I set a value for it per membership?
Sat 26 Jan 2019 at 15:38 #59497FrankyKeymasterYou 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, …).
Mon 28 Jan 2019 at 17:45 #59508AnonymousInactiveThanks, 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?
Mon 28 Jan 2019 at 18:13 #59509FrankyKeymasterThe 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 …Mon 28 Jan 2019 at 23:24 #59510AnonymousInactiveThank 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?
Tue 29 Jan 2019 at 00:16 #59511FrankyKeymasterI’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)
Tue 29 Jan 2019 at 21:25 #59512AnonymousInactiveAwesome, thanks F! Custom fields for membership forms especially will be very powerful!
Tue 29 Jan 2019 at 23:20 #59513FrankyKeymasterIt 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.
Wed 30 Jan 2019 at 05:55 #59514AnonymousInactiveAh yes, I meant Custom Fields defined per membership that can of course be used in Membership Form Templates.
Wed 30 Jan 2019 at 19:31 #59515FrankyKeymasterWell, the code is ready for testing. So if you feel up for it …
Wed 30 Jan 2019 at 20:36 #59516AnonymousInactiveSure, 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?
Thu 31 Jan 2019 at 00:31 #59517FrankyKeymasterI 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).Thu 31 Jan 2019 at 19:35 #59519AnonymousInactiveOk thanks for the update! Good luck jumping through their hoops.
Thu 31 Jan 2019 at 23:42 #59521FrankyKeymasterWell, 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.Fri 1 Feb 2019 at 23:47 #59529AnonymousInactiveOkay, 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:
Sat 2 Feb 2019 at 01:01 #59531FrankyKeymasterYeah, type hidden won’t show much now, would it (and it needs to be of type membership)?
Sat 2 Feb 2019 at 01:57 #59534AnonymousInactiveI thought that I would be able to set a Membership-specific value for custom fields from that Custom Fields tab view. Is that incorrect?
Sat 2 Feb 2019 at 10:35 #59536FrankyKeymasterWell, 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.Mon 4 Feb 2019 at 23:05 #59559AnonymousInactiveWell, 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.
Mon 4 Feb 2019 at 23:17 #59560FrankyKeymasterYou’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)Mon 4 Feb 2019 at 23:20 #59561AnonymousInactiveOh 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?
Tue 5 Feb 2019 at 00:10 #59562FrankyKeymasterLike 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.Tue 5 Feb 2019 at 00:55 #59566AnonymousInactiveOh 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.
Tue 5 Feb 2019 at 01:06 #59567AnonymousInactiveCan 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>
Thu 7 Feb 2019 at 22:12 #59605AnonymousInactiveping
Thu 7 Feb 2019 at 23:03 #59606FrankyKeymasterWell, yes 🙂
Thu 7 Feb 2019 at 23:26 #59608AnonymousInactiveThank you!!
-
AuthorPosts
- The forum ‘How do I …’ is closed to new topics and replies.