Problems, need help? Have a tip or advice? Post it here.
15 posts Page 1 of 2
I am trying to add extra custom fields to add to members profiles. My problem is when I am filling out the registration form all my fields that I have added that are set as required come back with the message "Required field cannot be left empty" even though I have filled them out.

Here is my code for the members/register.php page:
Code: Select all
<cms:form enctype="multipart/form-data" method='post' anchor='0' class=''>
    <cms:if k_success >
        <!--
            The 'member_process_registration_form' tag below expects fields named
            'member_displayname', 'member_name' (optional), 'member_email',
            'member_password' and 'member_password_repeat'
        -->
        <cms:member_process_registration_form />
        <cms:if k_success >
            <cms:set_flash name='success_msg' value='1' />
            <cms:redirect k_page_link />
        </cms:if>
    </cms:if>
    <cms:if k_error >
        <p class="form-error"><cms:each k_error ><cms:show item /><br /></cms:each></p>
    </cms:if>
    <div class="form-group">
        <label for="member_firstname">First Name*</label>
        <cms:input type='text' name='member_firstname' id='member_firstname' class='form-control' />
    </div>
    <div class="form-group">
        <label for="member_lastname">Last Name*</label>
        <cms:input type='text' name='member_lastname' id='member_lastname' class='form-control' />
    </div>
    <div class="form-group">
        <label for="member_phone">Phone Number*</label>
        <cms:input type='text' name='member_phone' id='member_phone' class='form-control phone' />
    </div>
    <div class="form-group">
        <label for="member_address">Home Address*</label>
        <cms:input type='text' name='member_address' id='member_address' class='form-control' />
    </div>
    <hr>
    <div class="form-group">
        <label for="member_email">Email Address*</label>
        <cms:input type='text' name='member_email' id='member_email' class='form-control' />
    </div>
    <div class="form-group">
        <label for="repeat_member_email">Repeat Email Address*</label>
        <cms:input type='text' name='repeat_member_email' id='repeat_member_email' class='form-control' />
    </div>
    <div class="form-group">
        <label for="member_password">Password*</label>
        <cms:input type='password' name='member_password' id='member_password' class='form-control' />
    </div>
    <div class="form-group">
        <label for="member_password_repeat">Repeat Password*</label>
        <cms:input type='password' name='member_password_repeat' id='member_password_repeat' class='form-control' />
    </div>
    <hr>
    <div class="form-group">
        <label for="member_lot_1">MRTCA Lot Number* (Name must be included on title)</label>
        <cms:input type='text' name='member_lot_1' id='member_lot_1' class='form-control lot-number' />
        <small>Enter lot number in format of "A-1" where "A" is the Territory code and "1" is the lot number.</small>
    </div>
    <div class="form-group">
        <label for="member_lot_2">Additional MRTCA Lot Number (optional)</label>
        <cms:input type='text' name='member_lot_2' id='member_lot_2' class='form-control lot-number' />
    </div>
    <div class="form-group">
        <label for="member_lot_3">Additional MRTCA Lot Number (optional)</label>
        <cms:input type='text' name='member_lot_3' id='member_lot_3' class='form-control lot-number' />
    </div>
    <div class="form-group">
        <label for="member_lot_4">Additional MRTCA Lot Number (optional)</label>
        <cms:input type='text' name='member_lot_4' id='member_lot_4' class='form-control lot-number' />
    </div>
    <div class="form-group">
        <label for="member_lot_5">Additional MRTCA Lot Number (optional)</label>
        <cms:input type='text' name='member_lot_5' id='member_lot_5' class='form-control lot-number' />
    </div>
    <hr>
    <div class="checkbox">
        <cms:input type="checkbox" name="member_bod_updates" id="member_bod_updates" opt_values="Receive email updates from the BOD=Yes" />
    </div>
    <div class="checkbox">
        <cms:input type="checkbox" name="member_terms" id="member_terms" opt_values="Agree to the =Agree" />
        <a href="#">Terms and Conditions</a>*
    </div>
    <cms:input type="submit" name="submit" value="Create account" class="btn btn-success"/>
</cms:form>


And here is the code on the members/index.php page that includes the extra fields:
Code: Select all
        <cms:template clonable='1' title='Members'>

            <cms:member_define_fields />
           
            <!--
                Fields for 'email', 'password' and 'active' already come pre-defined.
                If more fields are required, they can be defined here below in the usual manner.
            -->       

            <cms:editable name='repeat_member_email' label='Display Name/Email Address' desc='This should just be a repeat of the email address field' type='text' required='1' validator='matches_field=member_email' />
            <cms:editable name='member_firstname' label='First Name' type='text' required='1' />
            <cms:editable name='member_lastname' label='Last Name' type='text' required='1' />
            <cms:editable name='member_phone' label='Phone Number' type='text' required='1' />
            <cms:editable name='member_address' label='Home Address' desc='Full address of member.' type='text' required='1' />
            <cms:editable name='member_lot_1' label='1st Lot #' desc='Enter lot number in format of "A-1". Only one lot per field.' type='text' required='1' />
            <cms:editable name='member_lot_2' label='2nd Lot #' desc='Enter lot number in format of "A-1". Only one lot per field.' type='text' />
            <cms:editable name='member_lot_3' label='3rd Lot #' desc='Enter lot number in format of "A-1". Only one lot per field.' type='text' />
            <cms:editable name='member_lot_4' label='4th Lot #' desc='Enter lot number in format of "A-1". Only one lot per field.' type='text' />
            <cms:editable name='member_lot_5' label='5th Lot #' desc='Enter lot number in format of "A-1". Only one lot per field. Only 5 lots can be assigned to a single account' type='text' />
            <cms:editable name='member_bod_updates' label='Email Updates' desc='Member agrees to get email updates from the BOD' type='checkbox' opt_values="Receive email updates from the BOD=Yes" />
            <cms:editable name='member_terms' label='Terms and Conditions' desc='Member agrees to Terms and Conditions' type='checkbox' required='1' opt_values="Agree to the Terms and Conditions=Agree" />

        </cms:template>


What am I doing wrong here?
Thanks for creating the new thread.

Could you try specifying the custom fields to be persisted in editable regions as parameters to the member_process_registration_form tag:
Code: Select all
<cms:member_process_registration_form
    member_firstname = frm_member_firstname
    member_lastname = frm_member_lastname
    member_phone = frm_member_phone
    member_address = frm_member_address
    repeat_member_email = frm_repeat_member_email
    member_lot_1 = frm_member_lot_1
    member_lot_2 = frm_member_lot_2
    member_lot_3 = frm_member_lot_3
    member_lot_4 = frm_member_lot_4
    member_lot_5 = frm_member_lot_5
    member_bod_updates = frm_member_bod_updates
    member_terms = frm_member_terms
/>
This is referenced at 5b on viewtopic.php?f=5&t=8063.
cheesypoof wrote: Thanks for creating the new thread.

Could you try specifying the custom fields to be persisted in editable regions as parameters to the member_process_registration_form tag:
Code: Select all
<cms:member_process_registration_form
    member_firstname = frm_member_firstname
    member_lastname = frm_member_lastname
    member_phone = frm_member_phone
    member_address = frm_member_address
    repeat_member_email = frm_repeat_member_email
    member_lot_1 = frm_member_lot_1
    member_lot_2 = frm_member_lot_2
    member_lot_3 = frm_member_lot_3
    member_lot_4 = frm_member_lot_4
    member_lot_5 = frm_member_lot_5
    member_bod_updates = frm_member_bod_updates
    member_terms = frm_member_terms
/>
This is referenced at 5b on viewtopic.php?f=5&t=8063.


That's what I was missing!!!! Thank you so much! I was just looking at that part in the docs when you posted, just wasn't entirely sure if this was how it was supposed to go, but it works great!

Thanks again!
I have already read this solution but whatever I do it doesn't seem to work :/
@EliasSek, I have posted the solution to your problem in your original thread -
viewtopic.php?f=4&t=9846&p=22469#p22469
I believe I've done everything as @cheesypoof said, but I am getting the "Required field can not be left empty" error.

I've added four new fields to the register template.
And here are the four added fields to the clonable index.php template:

Code: Select all
<cms:editable name="company_name" label="Company name" type="text" required="1" />
<cms:editable name="company_address" label="Company address" type="text" required="1" />
<cms:editable name="your_phone_number" label="Phone number" type="text" required="1" />
<cms:editable type='checkbox'  name="business_category" label="Choose business category" opt_values='Retail Store|Interior designer|Wholesaler|Other' required='1'/>


And here is the part added to <cms:member_process_registration_form /> tag :

Code: Select all
company_name = frm_company_name
company_address = frm_company_address
your_phone-number = frm_your_phone_number
business_category = frm_business_category


I am missing something obvious, I just know it !! :D
madebym wrote: your_phone-number = frm_your_phone_number

I am missing something obvious, I just know it !! :D
Thanks for spotting that @cheesypoof, but unfortunately it didn't help.


I still get the same error message, the email arrives correctly, but a new user is not created.


p.s. I just want to add that everything works fine if I am not adding new fields to the clonable template. Registration process goes smoothly.
@madebym, precisely which field is throwing the error?
What does the k_error block below report exactly?
Code: Select all
<cms:if k_error >
   <font color='red'><cms:each k_error ><cms:show item /><br /></cms:each></font>
</cms:if>
@KK If I display the errors like you posted I get a warning that one of my fields cannot be left empty(namely the checkbox field). That is after filling all the fields and submitting. But the email is still being sent. And the value of the checkbox is shown in the email.

It is just that a new member is not registered. It is throwing an error, but the email which arrives is fine. Clearly, this error is preventing the new member registration.

If I display the errors like this, I just get the "Please correct the following errors" displayed, with no actual error messages inside.

Code: Select all
                <cms:if k_error >
                <div class="error-holder">
      <h6>Please correct the following errors </h6>
      <cms:if k_error_member_displayname>
               <p class='error'>Enter contact name</p>
               </cms:if>
           <cms:if k_error_company_name>
               <p class='error'>Enter company name</p>
               </cms:if>
      <cms:if k_error_company_address>
               <p class='error'>Enter Company address</p>
               </cms:if>
           <cms:if k_error_your_phone_number>
               <p class='error'>Enter phone number</p>
               </cms:if>
      <cms:if k_error_member_email>
               <p class='error'>Enter email address</p>
               </cms:if>
      <cms:if k_error_member_password>
               <p class='error'>Enter password</p>
               </cms:if>
      <cms:if k_error_business_category>
               <p class='error'>Choose business category</p>
               </cms:if>
         </div>
                </cms:if>


The funny thing is that if I submit the form without filling any field, "Choose business category" warning is displayed in the list.

But after filling all the fields it is not displayed, yet it is displayed if I show the errors this way
Code: Select all
<cms:if k_error >
   <font color='red'><cms:each k_error ><cms:show item /><br /></cms:each></font>
</cms:if>
15 posts Page 1 of 2

Who is online

In total there are 5 users online :: 0 registered, 0 hidden and 5 guests
(based on users active over the past 5 minutes)

Users browsing this forum: No registered users and 5 guests