latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Custom registration form with optional fields

Home Forums Community Forum Custom registration form with optional fields

This topic contains 2 replies, has 2 voices. Last updated by  fresatura 4 years ago.

Topic Author Topic
Posted: Thursday Dec 13th, 2012 at 11:38 am #34476
fresatura
Username: fresatura

Hello,
I would like to create a registration form with a choice.
I would like to let people on the same level register
• with children
• who don’t have.
(all this is free no paypal)
All have the same access to content, and therefore, the same level.
If they have children
• there would be some info required,
but if they don’t,
• the fields should be hidden.
Someone already posted a similar issue.
You suggested to build a custom template
(http://www.s2member.com/forums/topic/customizing-custom-registrationprofile-field/)
Should I place the php for the query in the template?
Sorry if this is a stupid question but I am a bit lost.

Or, I could maybe hide a whole section of custom fields via css or jQuery
and onClick display the hidden section.
It doesn’t seem to be a clever solution;(….
But I am searching for several days now and have no idea how to realize.

Thank you very much in advance.

List Of Topic Replies

Viewing 2 replies - 1 through 2 (of 2 total)
Author Replies
Author Replies
Posted: Friday Dec 14th, 2012 at 9:30 am #34656
Staff Member

Thanks for the heads up on this thread.

I would suggest that you create ALL of your Custom Registration/Profile Fields in s2Member (including those which you may or may NOT collect, based on the way a particular form is being filled out; i.e. has children or not).

Next, I would implement some custom JavaScript that manipulates the form to accomplish this dynamically. This way you can hide/show certain form fields, based on HOW the form has been filled out thus far.

s2Member works from the aria-required attribute. So if you need to suppress JavaScript validation on form fields that you’re NOT planning to require, you can simply set the form field attribute aria-required="false" through your own custom JavaScript routines.

For example, if having no children indicates that form fields x,y,z do NOT need to be filled in, your custom JavaScript can hide those fields from view, and also set the aria-required="false" attribute. You set that attribute on the form field itself, and NOT on the containing div element that holds the field.

Someone already posted a similar issue.
You suggested to build a custom template
(http://www.s2member.com/forums/topic/customizing-custom-registrationprofile-field/)
Should I place the php for the query in the template?

That’s certainly an option as well, and that would be just a good. Possibly more work, but you will have even more control over things this way. Yes, you can place any custom code right into your custom template file.

Posted: Sunday Dec 16th, 2012 at 7:46 am #34770
fresatura
Username: fresatura

Thank you very much for your detailed and helpful answer.
Special thanks for the aria-required attribute hint.
I will try what works for me best.
I am pretty relieved that I am heading in the right direction.
Thanks a lot.

Viewing 2 replies - 1 through 2 (of 2 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.