Problems, need help? Have a tip or advice? Post it here.
13 posts Page 2 of 2
But if I set it as "text", the user details won't show up in input field like "bound" did.
We can explicitly set the text input's value to the page's title as follows -
Code: Select all
DisplayName:<br />
<cms:pages masterpage=k_member_template id=k_member_id skip_custom_fields='1' limit='1'>
    <cms:input type="text" name="my_title" label='DisplayName' style="width:200px;" required='1' value="<cms:show k_page_title />" /><br />
</cms:pages>

The result would be exactly the same as using a bound field.

And the worse part is the password and repeat password, the will also submit even if they don't match.
But then why are you using the password and repeat password fields as normal text in the first place? Use them in the prescribed 'bound' manner and they'll function as expected.

I did not mean to say that you should ditch all bound inputs and switch to text inputs. Do this only for very specific constraint that is not supported by the bound field.

I can't see what additional constraint you'd want to place on 'password' and 'repeat password'. They are already 'required' if the user chooses to enter any values into them (which means that the user is trying to edit his existing password).

Please elaborate.
@KK, I am truly sorry if I cause too many troubles, I tried to solve it by myself but I just can't. This is the very last problem that I faced on this project. I really appreciate your help. Thank you.

Actually I put "bound" on password input field, I never change it.

Code: Select all

<cms:input type="bound" name="member_password" placeholder="Password" Label="Password"  /><br />
<cms:input type="bound" name="member_password_repeat" placeholder="Repeat Password" Label="Repeat Password" /><br />


If I enter un-matched password, it will still submit. How can I solve it?

This is the whole code I'm using:
Code: Select all
<cms:if k_success >
            <cms:db_persist_form
               k_page_title = frm_member_name
               company_name = frm_company_name
               tel=frm_tel
               member_email = frm_member_email
               member_password = frm_member_password
               member_password_repeat = frm_member_password_repeat
             />

            <cms:set_flash name='success_msg' value='1' />
            <cms:redirect k_page_link />
        </cms:if> 
       
        <cms:if k_error >
                    <p class="notice"><font color='red'><cms:each k_error ><cms:show item /><br /></cms:each></font></p>
                </cms:if>
       
        <cms:pages masterpage=k_member_template id=k_member_id>
        <cms:input type="text" name="member_name" placeholder="Your Name" Label="Your Name" required="1" value="<cms:show k_page_title />" /><br />
       
       
        <cms:input name="company_name" type="text" placeholder="Company Name" Label="Company Name" required='1' value="<cms:show company_name />" /><br />
               
        <cms:input name="tel" type="text" placeholder="Tel" Label="Tel" required='1'  value="<cms:show tel />" /><br />

        <cms:input type="text" name="member_email" validator='email' placeholder="Email" Label="Email" required='1'  value="<cms:show k_member_email />" /><br />

       
       If you would like to change the password type a new one. Otherwise leave this blank.<br />
       
        <cms:input type="bound" name="member_password" placeholder="Password" Label="Password"  /><br />
<cms:input type="bound" name="member_password_repeat" placeholder="Repeat Password" Label="Repeat Password" /><br />
        </cms:pages>
         
       
        <!-- give an option to logout -->
          <div class="row">
           <div class="col-md-12">
             <button class="submit" type="submit" name="submit"><span class="submit-text">Save</span></button> 
               </div>
In my 'members/index.php' template, I added two custom fields as follows to match your setup -
Code: Select all
<cms:editable type='text' name='company_name' required='1' />
<cms:editable type='text' name='tel' required='1' />

The following code in my 'members/profile.php' is working perfectly -
Code: Select all
    <cms:form 
        masterpage=k_member_template
        mode='edit'
        page_id=k_member_id
        enctype="multipart/form-data"
        method='post'
        anchor='0'
        >
       
        <cms:if k_success >
            <cms:db_persist_form
                k_page_title = frm_member_name
            />

            <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 >
            <font color='red'><cms:each k_error ><cms:show item /><br /></cms:each></font>
        </cms:if>
       
       
        DisplayName:<br />
        <cms:pages masterpage=k_member_template id=k_member_id>
            <cms:input type="text" name="member_name" placeholder="Your Name" Label="Your Name" required="1" value="<cms:show k_page_title />" style="width:200px;" /><br />
        </cms:pages>

        Company:<br />
        <cms:input type="bound" name="company_name" style="width:200px;" /><br />
       
        Tel:<br />
        <cms:input type="bound" name="tel" style="width:200px;" /><br />
       
        E-mail:<br />
        <cms:input type="bound" name="member_email" style="width:200px;" /><br />


        New Password: (If you would like to change the password type a new one. Otherwise leave this blank.)<br />
        <cms:input type="bound" name="member_password" style="width:200px;" /><br />


        Repeat Password:<br />
        <cms:input type="bound" name="member_password_repeat" style="width:200px;" /><br />


        <input type="submit" name="submit" value="Save"/>   
       
    </cms:form>

Please first copy and paste it into your template to use it *exactly* as it is.
Make your changes only once you can see that things do work.

As I suggested earlier, use only the k_page_title field as a normal input (as I have done above). Use all the other fields as 'bound'.

Hope it helps.
13 posts Page 2 of 2
cron