Forum for discussing general topics related to Couch.
35 posts Page 3 of 4
Can it be that with the multi-step forms the input fields don't get cleared after I submitted everything? Even after the reload all the data I entered is still there :/.
Not sure if I understood the problem completely but I think if you use cms:redirect as the last step in k_success condition (using flash variables for the success message - the way the examples in DataBound Form docs show http://www.couchcms.com/docs/concepts/d ... forms.html), that would reset everything to the initial state.

Does it help?
I tried that, or at least I think I did. Here is the form I'm using:

Code: Select all
<cms:set success_msg="<cms:get_flash 'success_msg' />" />
<cms:if success_msg >
   <div class="notice">
      <cms:if success_msg='1' >
         <h3>Account erstellt</h3>
         <p><cms:show fl_user_name/>Der Account wurde erfolgreich erstellt.<br/>
         Bitte verifiziere die Registrierung indem Du auf den Link in der soeben von uns versandten E-Mail klickst.</p>
         <cms:form anchor='0' method='post'>
         <cms:if k_success >
            <cms:redirect k_page_link />   
         </cms:if>
         <cms:input type="submit" value="Reload" name="submit"/>
         </cms:form>
      <cms:else />
         <h3>Account activiert</h3>
         <p>Die Aktivierung war erfolgreich! Du kannst Dich jetzt einloggen!</p>
         <ul class="actions">
         <li><a class="button special" href="<cms:login_link redirect=k_site_link />">Login</a></a>
         </ul>
      </cms:if>
   </div>
<cms:else />
   
   
   <cms:set action="<cms:gpc 'act' method='get'/>" />
   
   
   <cms:if action='activate' >
      <h3>Activiere Account</h3>
   
      <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 = '5' />
      
      <cms:embed 'multi_form_handler.html' />
      
      <cms:if k_current_step gt total_pages >
      
      <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_title=frm_user_name
         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'
         extended_user_email=frm_user_email
         extended_user_password=frm_user_password
         extended_user_password_repeat=frm_user_password_repeat
         user_gender=frm_user_gender
         user_surname=frm_user_surname
         user_birthplace=frm_user_birthplace
         user_birthdate=frm_user_birthdate
         user_phone=frm_user_phone
         user_street=frm_user_street
         user_zip=frm_user_zip
         user_city=frm_user_city
         user_lessons=frm_user_lessons
      >

         <cms:if k_error >
            <font color='red'>ERROR:
            <cms:each k_error >
               <cms:show item /><br>
            </cms:each>
            </font>
         <cms:else />
            <cms:send_mail from="<cms:php>echo K_EMAIL_FROM;</cms:php>" to=frm_user_email subject='New Account Confirmation' debug='1'>Hallo <cms:show frm_user_name/>,
            
vielen Dank für die Registrierung!

Nachdem Du deinen Account freigeschaltet hast, kannst Du Dich entweder mit deiner E-Mail Adresse oder deinem Benutzernamen einloggen.

Deine Daten

Benutzername: <cms:php> global $FUNCS; echo $FUNCS->get_clean_url( '<cms:show user_page_name/>' );</cms:php>
E-Mail: <cms:show frm_user_email/>
            
Bitte klicke auf den folgenden Link, um deinen Account zu aktivieren:
<cms:activation_link   frm_user_email   />

Vielen Dank
            </cms:send_mail>
            <cms:send_mail from="<cms:php>echo K_EMAIL_FROM;</cms:php>" to="" subject='New Account Registration' debug='1'><cms:show frm_user_name/> <cms:show frm_user_surname/> registered to the Kobukan website.
<cms:show   frm_extended_user_email   />
            </cms:send_mail>
                           
            <cms:set_flash name='success_msg' value='1' />
            <cms:redirect k_page_link />
         </cms:if>


      </cms:db_persist>
      
      <cms:else />
      
         <cms:if k_current_step='1' >
         
         
         <header>
         <h3>Registrierung</h3>
         </header>
         
         
         
            Registrierungscode:<br />
            <cms:input
            type="text"
            required='1'
            validator='regex=/^k0buk4n$/i'
            class="input-text required-entry"
            id="regcode"
            name="reg_code"
            placeholder="Registrierungscode"/>
            <cms:if k_error_reg_code ><br/><span style="color:red"><cms:show k_error_reg_code /></span></cms:if>
         
         
         </cms:if>
         
         <cms:if k_current_step='2' >
         
         
            <header>
               <h3>Verwendung pers&ouml;nlicher Daten</h3>
               <p>Schritt <cms:show k_current_step/> von <cms:show total_pages/></p>
            </header>
         
         
         
            <hr/>
            <p>Bitte ankreuzen, sofern diese Daten mit allen Mitgliedern geteilt werden sollen:</p>
            <cms:input name="show_birthdate" type='checkbox' opt_values='<span></span>Geburtsdatum=1'/>
            <cms:input name="show_address" type='checkbox' opt_values='<span></span>Anschrift=1'/>
            
         
         
         </cms:if>
         
         <cms:if k_current_step='3' >
         
         
         <header>
         <h3>Pers&ouml;nliche Informationen</h3>
         <p>Schritt <cms:show k_current_step/> von <cms:show total_pages/></p>
         </header>
         
         
         
            Anrede:<br />
            <cms:input name='user_gender' type='dropdown' opt_values='Herr=m | Frau=w' required='1'/>
            
         
         
            Vorname:<br />
            <cms:input name='user_name' type='text' placeholder="Vorname" required='1'/>
            <cms:if k_error_user_name ><br/><span style="color:red"><cms:show k_error_user_name /></span></cms:if>
         
         
            Nachname:<br />
            <cms:input name='user_surname' type='text' placeholder="Nachname" required='1' />
            <cms:if k_error_user_surname ><br/><span style="color:red"><cms:show k_error_user_surname /></span></cms:if>
         
         
            Nationalit&auml;t:<br />
            <cms:input name='user_nationality' type='text' placeholder="Nationalit&auml;t" required='1'/>
            <cms:if k_error_user_nationality ><br/><span style="color:red"><cms:show k_error_user_nationality /></span></cms:if>
         
         
            Geburtsort:<br />
            <cms:input name='user_birthplace' type='text' placeholder="Geburtsort" required='1'/>
            <cms:if k_error_user_birthplace ><br/><span style="color:red"><cms:show k_error_user_birthplace /></span></cms:if>
         
                           
            Geburtsdatum:<br />
            <cms:input name='user_birthdate' type='datetime' required='1'/>
            <cms:if k_error_user_birthdate ><br/><span style="color:red"><cms:show k_error_user_birthdate /></span></cms:if>
         
         
         <h4>Kontakt</h4>
         
         
            E-Mail:<br/>
            <cms:input name='user_email' type='text' placeholder="E-Mail Adresse" required='1' validator='email'/>
            <cms:if k_error_user_email ><br/><span style="color:red"><cms:show k_error_user_email /></span></cms:if>
         
         
            Telefon Festnetz (optional):<br />
            <cms:input name='user_phone' type='text' placeholder="Festnetz" validator='integer'/>
            <cms:if k_error_user_phone ><br/><span style="color:red"><cms:show k_error_user_phone /></span></cms:if>
         
         
            Telefon Mobil:<br />
            <cms:input name='user_mobile' type='text' placeholder="Mobil" validator='integer' required='1'/>
            <cms:if k_error_user_mobile ><br/><span style="color:red"><cms:show k_error_user_mobile /></span></cms:if>
         
         
         <h4>Anschrift</h4>
         
         
            <cms:input name='user_street' type='text' width='100%' placeholder="Straße" required='1' />
            <cms:if k_error_user_street ><br/><span style="color:red"><cms:show k_error_user_street /></span></cms:if>
         
         
            <cms:input name='user_zip' type='text' width='100%' placeholder="PLZ" required='1' />
            <cms:if k_error_user_zip ><br/><span style="color:red"><cms:show k_error_user_zip /></span></cms:if>
         
                        
            <cms:input name='user_city' type='text' width='100%' placeholder="Stadt" required='1' />
            <cms:if k_error_user_city ><br/><span style="color:red"><cms:show k_error_user_city /></span></cms:if>
         
         
            <hr/>
         
         
            Passwort:<br />
            <cms:input name='user_password' type='password' placeholder="Passwort" required='1'/>
            <cms:if k_error_user_password ><br/><span style="color:red"><cms:show k_error_user_password /></span></cms:if>
         
         
            Passwort wiederholen:<br />
            <cms:input name='user_password_repeat' type='password' placeholder="Passwort wiederholen" 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:if>
         
         <cms:if k_current_step='4' >
         
         
            <header>
               <h3>Medizinische Informationen</h3>
               <p>Schritt <cms:show k_current_step/> von <cms:show total_pages/></p>
            </header>
            <p>xyz</p>
         
         
         
            <cms:input name='user_condition' type='textarea' width='100%' height='200' placeholder="Medizinische Informationen" />
         
         
         </cms:if>
         
         <cms:if k_current_step='5' >
         
         
         <header>
         <h3>Training</h3>
         <p>Schritt <cms:show k_current_step/> von <cms:show total_pages/></p>
         </header>
         
         
         
            <h4>Trainingszeiten:</h4>
         
         
            <cms:input name="user_lessons" type='checkbox' opt_values='<span></span>Mittwoch (Unisport)=Wed | <span></span>Freitag (Unisport)=Fri | <span></span>Saturday=Sat' />
         
         
            <p>Mitglieder, die zur Zeit nicht aktiv am Training teilnehmen, wählen bitte keine Trainingszeit. Damit gilt der Mitgliedsstatus als inaktiv für alle trainingsrelaventen Zwecke.</p>
         
         
            <hr/>
            <h4>Verhaltensregeln:</h4>
            <cms:get_custom_field var='content' masterpage='index.php' page='etiquette' />
            <cms:input name="user_codeofconduct" type='checkbox' opt_values='<span></span>Ich akzeptiere die Verhaltensregeln=1' required='1'/>
            <cms:if k_error_user_codeofconduct ><br/><span style="color:red"><cms:show k_error_user_codeofconduct /></span></cms:if>
         
         
         </cms:if>
         
         
         <cms:if k_current_step gt '1'><input type="submit" name="back" value="Previous"></cms:if>
         <input type="submit" name="next" value="<cms:if k_current_step=total_pages>Finish<cms:else />Next</cms:if>">
         
         
      </cms:if>
      
   
      </cms:form>
   
   </cms:if>
</cms:if>
@klaus,

Please edit 'multi_form_handler.html' snippet and uncomment (i.e. remove the leading double-slashes) from the second line below -
// Uncomment the following line if saved data is to be discarded at final submission
//if( $current_page>$total_pages ){ $data=array(); }

I think that should do it. Please let me know.
It does. Thank you very much!
You are welcome :)
Hi,

I'm having another problem, which unnerves me incredibly since I have no idea why it's not doing what I want:

I have said multi-step form above, and I'm asking for the birthdate
Code: Select all
Geburtsdatum:<br />
            <cms:input name='user_birthdate' type='datetime' required='1'/>
            <cms:if k_error_user_birthdate ><br/><span style="color:red"><cms:show k_error_user_birthdate /></span></cms:if>

then I push the value submitted into the editable datetime field of users/index.php
Code: Select all
user_birthdate=frm_user_birthdate

But it's not getting through. I can sucessfully change k_publish_date or do anything else with frm_user_birthdate, but nothing gets saved here in users/index.php
Code: Select all
   <cms:editable
      name='user_birthdate'
      label='Birthdate'
      type='datetime'
      group='data'/>

Any ideas?
I see the problem, Klaus.

You are not using a 'datetime' editable region in a bound manner. Rather, you are explicitly pushing a value into it while saving the page. Problem here is that the 'datetime' region does not support explicit setting of its value.

This can be termed as a bug.
I'll fix it ASAP but it'll require a bit of testing to make sure the change doesn't break anything.

So please give me some time (couple of days, maybe) and I'll get back with the rectified code.

Thanks.
Thanks. Much appreciated!!
Any progress? :D
35 posts Page 3 of 4