Forum for discussing general topics related to Couch.
35 posts Page 4 of 4
Have PMed you a patch. Please check.
Thanks.
Hi again!

I ran into a little problem again - which is the error messages are not showing correctly (or at least I assume it is - I'm using it again for another user registration. One first has to enter a code to make sure one is allowed to register, then one enters the details. However instead of having an error shown if the email address is already used the thing will be executed never the less and a message send to the person signing up, just without a validation link inside...)

Anyhow, to make it short, is there a way to set k_current_step by my own? I would like to skip the first step of the form (since the code was already entered) and jump direclty to the second where I can then show the error message.
@klaus, would be difficult to say anything without taking a look at the code.
If possible, try to create a simplified multi-step form that exhibits the same problem and please get me the code to examine.
So no way of targeting k_current_step directly? Because then I could jump the first part (as by then it's confirmed that the access code is valid) and display a message by myself.

Code: Select all
<h1>User registration</h1>
      
<cms:set success_msg="<cms:get_flash 'success_msg' />" />

<cms:if success_msg >
   <div class="notice">
      <cms:if success_msg='1' >
         <h2>Account created</h2>
         <p>Your account has been created successfully and we have sent you an email.<br />
            Please click the verification link within that mail to activate your account.</p>
      <cms:else />
          <cms:no_cache />
         <h2>Activation successful</h2>
         <p>You can now log in!<br />
         <a href="<cms:login_link redirect=k_site_link />">Login</a></p>
      </cms:if>
   </div>
<cms:else />   
   
   <cms:set action="<cms:gpc 'act' method='get'/>" />
   
   <cms:if action='activate' >
      <h2>Activate account</h2>
   
      <cms:process_activation />
      
      <cms:if k_success >
          <cms:set_flash name='success_msg' value='2' />
          <cms:redirect k_page_link />         
      <cms:else />
         <cms:show k_error />
      </cms:if>
   
   <cms:else />

      <cms:form anchor='0' method='post'>
      
         <cms:set total_pages = '2' />
         
         <cms:embed 'multi_form_handler.html' />
         
         <cms:if k_current_step gt total_pages >
         

            <cms:check_spam email=frm_extended_user_email />
            
            <cms:set user_page_name="<cms:show frm_user_name/> <cms:show frm_user_surname/>"/>
         
            <cms:db_persist
               _masterpage=k_user_template
               _mode='create'
               _separator='|'
               _invalidate_cache='0'
               _auto_title='0'

               k_page_name = "<cms:php> global $FUNCS; echo $FUNCS->get_clean_url( '<cms:show user_page_name/>' );</cms:php>"
               k_publish_date = '0000-00-00 00:00:00'
               k_page_title=frm_user_name
               extended_user_email=frm_user_email
               extended_user_password=frm_user_password
               extended_user_password_repeat=frm_user_password_repeat
               user_lastname=frm_user_surname
            />

               <cms:if k_error >
                  <font color='red'>ERROR:
                  <cms:each k_error >
                     <cms:show item /><br>
                  </cms:each>
                  </font>
               <cms:else />
                  <cms:send_mail/>
                                 
                  <cms:set_flash name='success_msg' value='1' />
                  <cms:redirect k_page_link />
               </cms:if>
               </cms:if>


         
         <cms:else />
         
            <cms:if k_current_step='1' >
            
            <header>
            <h2>Enter registration code:</h2>
            <p>Please enter the registration code to determine your membership status.</p>
            </header>
            
            <p><cms:input name="access_code" type='text' required='1' autocomplete="off" />
            <cms:if k_error_access_code ><br/><span style="color:red"><cms:show k_error_access_code /></span></cms:if></p>

            </cms:if>
            
            <cms:if k_current_step='2' >
            
            <cms:set registration_code="<cms:get_custom_field 'reg_code' masterpage='settings.php' />"/>
            
            <cms:set entered_code="<cms:show frm_access_code/>"/>
            <cms:set access_check="<cms:php> echo(substr(\"<cms:show entered_code />\", 0, 8));</cms:php>" />
            <cms:set belongs_to="<cms:php> echo(substr(\"<cms:show entered_code />\", 9, -2));</cms:php>" />
            
            <cms:if registration_code=access_check>
            
               <cms:if belongs_to != '' >
                  <cms:set cm_exists="<cms:pages masterpage='corpmembers.php' id=belongs_to limit='1' count_only='1' />" />
               </cms:if>
               
               <cms:if cm_exists >
            <header>
            <p>Registration confirmed as part of the corporate membership of: </p>
            <h2><cms:pages masterpage='corpmembers.php' id=belongs_to><cms:show k_page_title/></cms:pages></h2>
            </header>
            
                  <cms:set continue_registration='1'/>
                  
               <cms:else_if entered_code=registration_code/>
               
            <header>
            <p>Registration confirmed as </p>
            <h2>Individual Member</h2>
            </header>
                  <cms:set continue_registration='1'/>
               </cms:if>
            </cms:if>
            
            <cms:if continue_registration='1'>
            
            First name:<br />
            <cms:input name='user_name' type='text' placeholder="First Name" required='1'/>
            <cms:if k_error_user_name ><br/><span style="color:red"><cms:show k_error_user_name /></span></cms:if>

            Last name:<br />
            <cms:input name='user_surname' type='text' placeholder="Last Name" required='1' />
            <cms:if k_error_user_surname ><br/><span style="color:red"><cms:show k_error_user_surname /></span></cms:if>

            Email Address:<br />
            <cms:input name='user_email' type='text' placeholder="Email addresse" required='1' validator='email'/>
            <cms:if k_error_user_email ><br/><span style="color:red"><cms:show k_error_user_email /></span></cms:if>
                                    
            Password:<br />
            <cms:input name='user_password' type='password' placeholder="Password" required='1' />
            <cms:if k_error_user_password ><br/><span style="color:red"><cms:show k_error_user_password /></span></cms:if>

            Repeat password:<br />
            <cms:input name='user_password_repeat' type='password' placeholder="Repeat password" validator='matches_field=user_password' required='1' />
            <cms:if k_error_user_password_repeat ><br/><span style="color:red"><cms:show k_error_user_password_repeat /></span></cms:if>

            
            <cms:else />
            <p>The code you entered is not valid. Please sign up for a membership or contact the webmaster for technical issues.</p>
            </cms:if>
            
            </cms:if>

            <cms:if k_current_step gt '1'>
               <input type="submit" name="back" value="Previous">
            </cms:if>
            <cms:if (k_current_step=total_pages) && (continue_registration='1')>
               <input type="submit" name="next" value="Create Account">
            <cms:else_if k_current_step='1' />
               <input type="submit" name="next" value="Next">
            </cms:if>
            
            
         </cms:if>
   
      </cms:form>
   
   </cms:if>
</cms:if>
It seems I'm always coming back to this one :)... with the radio <cms:input>s "opt_seleceted" seem to get ignored within the multi-steps and always the first option is selected, within various templates I'm using it (never used much radio inputs it seems... ;) ). Any ideas/solutions?
35 posts Page 4 of 4