Forum for discussing general topics related to Couch.
3 posts Page 1 of 1
I'm still on the already mentioned monster of a form/survey, but ran into another problem I just can't figure out but is probably something trivial concerning the whole logic of the thing... (btw., how do I actually access the premium support? Is the email address indicated on the bill the proper one to write to? - not that the support here is already the full deal already :D )

What I'm trying to do is to check within the success condition to check a bunch of values against each other. If they don't add up as they should create an error variable (holding something like "wrong_field_1|wrong_field_2") and after a page reload show an error message at the location using <cms:each>.

This all works as it should.

However for some reason the error variable seems to remain after the redirect, although the corrected values are properly saved into the template and therefore shouldn't throw out a new error. I need to submit the form once again to remove the error variable, which is confusing to me as it should already be gone?!

In short, the thing looks like the following:
Code: Select all
<cms:set error_msg="<cms:get_flash 'error_msg' />" />
<cms:show error_msg/>

<cms:form
   masterpage=k_template_name
   mode='edit'
   page_id=k_page_id
   enctype='multipart/form-data'
   method='post'
   anchor='0'
   >

   <cms:if k_success >
   
         <cms:set action="<cms:gpc 'action' />" />
         
         <cms:if action='Back' || action='Next'>
   
            <!---->
            /// To cut things shorter, here I'm going through the values of the bound
            editable regions and check for wrong inputs, giving me back the wrong fieldnames
            like 'name_field1|name_field4|name_field6...' as 'no_load_temperature_error'
            <!---->
         
         </cms:if>
         
      <cms:if no_load_temperature_error>
         
         <cms:db_persist_form
         
         />
      
         <cms:set_flash name='error_msg' value="<cms:show no_load_temperature_error/>" />
         <cms:redirect k_page_link />
      
      <cms:else/>
      
         <cms:set action="<cms:gpc 'action' />" />
         
         <cms:if action='Back' >
         
            <cms:db_persist_form
            
               ccdb_survey_step='3'
            
            />
         
         <cms:else_if action='Next' />
         
            <cms:db_persist_form
            
               ccdb_survey_step='5'
               
            />

         </cms:if>
         
         
         
         <cms:if "<cms:not k_persist_error />">
            <cms:redirect url="<cms:show k_page_link />" />
         </cms:if>
      
      </cms:if>
      
   </cms:if>

   <cms:if k_error >
      <div class="error">
      <p>
         <cms:each k_error >
            <span style="color:red"><br><cms:show item /></span>
         </cms:each>
      </p>
      </div>
   </cms:if>
   
   <cms:if error_msg>
   Error<br/>
   </cms:if>
   <!---->



      
      ///here I output the necessary inputs as bound
      

         <hr/>
      
         <input type="submit" name="action" value="Back"/>
         <input type="submit" name="action" value="Next"/>   

</cms:form>


Maybe using typ=bound inputs is the problem here and I should rather do it old-style to keep things separate?


And on a connected matter, can i use something like this within <cms:db_persist_form /> ?
Code: Select all
<cms:repeat count='10'>
editable_region_nr"<cms:show k_count/>"=frm_input_nr"<cms:show k_count/>"
</cms:repeat>
btw., how do I actually access the premium support? Is the email address indicated on the bill the proper one to write to?
Yes, you may drop me a mail on that address (please do indicate the licensed domain).

nothing on this? :/
3 posts Page 1 of 1