Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusion: required custom fields at registration #8

Closed
DavidOliver opened this issue Jun 28, 2012 · 2 comments
Closed

Confusion: required custom fields at registration #8

DavidOliver opened this issue Jun 28, 2012 · 2 comments

Comments

@DavidOliver
Copy link

Hi Michael,

Sorry to create an issue for this - I think the issue is my misunderstanding.

My members section has some custom fields (address fields, mainly) that need to be entered at registration, and are defined as required in the section.

I merrily edited my working copy of utilities/members.form-register.xsl:

<xsl:call-template name="members:input">
    <xsl:with-param name="field" select="'address-1'"/>
    <xsl:with-param name="event" select="$event"/>
</xsl:call-template>

The form HTML output label and input attribute values are blank.

Is this because:

  1. members-forms isn't intended to do this, and I should add the custom fields labels and inputs myself (or maybe use form-controls)?
  2. I need to add the fields and their possible XML error messages to members.config.xsl?
@michael-e
Copy link
Owner

Hi David, indeed Members forms has not been designed to work with standard Symphony fields. The fields provided by Members are rather special, and you probably won't be able to extend the templates to work with your custom fields.

So, short answer: Number 1 (members-forms isn't intended to do this). And no, you won't manage the Members fields using From Controls. You might try to use Form Controls for the other fields, but you should know that Form Controls is a biest as well. :-)

What you want to achieve is (sort of) "universal" postback values and validation, both for Members fields and (in this case: additional) Symphony core fields. Yes, this can be done, but it is a lot of work. I created a templating layer which does this for one of my projects, but for several reasons (mainly legal stuff and the support "load" it would create) I will not release this to the public.

So if we are just talking about 2 or 3 fields, my advice is to either try and hand-code only what you need or use Form Controls if you are comfortable with the abstraction it provides. You will end up having two validation lists, of course — one for the Members fields, one for the custom fields. But I guess one could style this nicely, so the user wouldn't see this as a problem.

@DavidOliver
Copy link
Author

Thanks for confirming. This helps me a lot in that I now know I'm not missing something fundamental. :-)

Yes, I meant using Form Controls only for the custom fields, not the Members fields. I have tried Form Controls in the past, but found some inconsistencies/issue if I remember correctly. Maybe it's time to try again and try and correct them.

I did try adding one of my custom fields to members.config.xsl, which seems to work:

<field type="title" handle="title">
    <label>Title</label>
    <errors>
        <email type="missing" message="'Title' is a required field."/>
    </errors>
</field>

This gives:

<div class="input">
    <label for="fields-title">Title</label>
    <input type="text" value="a" name="fields[title]" id="fields-title">
</div>

So maybe I'll also spend a little time testing this method out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants