I just ran into something weird. On every page I have with forms I have use set/get flash to handle success/errors but the thing is, the first time I submit an empty form to get the error, I only get my inputs to red (I set them to add a class on error to make them red) but the flash message will show only if you press the submit button the second time...I don't get it...
Also, simplifying it doesn't work either. Still have to submit twice in order to get the message
PS: I have no error in my console log and don't cache my pages (also no PrettyURL)
- Code: Select all
<!-- Set to Handle Everything -->
<cms:set locuinta_success="<cms:get_flash 'locuinta_success' />" />
<cms:set locuinta_error="<cms:get_flash 'locuinta_error' />" />
<cms:if locuinta_success >
<div class="contact_successbox">Success</div>
<cms:else_if locuinta_error />
<div class="contact_errorbox">Error</div>
</cms:if>
<!-- Set to Handle Everything -->
<!-- EXTENDED FORM -->
<cms:form id="contactForm" action="" method="POST" anchor="0">
<!-- Handle Everything -->
<cms:if k_success >
<cms:set_flash name='locuinta_success' value='1' />
<cms:redirect k_page_link />
<cms:else_if k_error />
<cms:set_flash name='locuinta_error' value='1' />
</cms:if>
...the rest of the form
Also, simplifying it doesn't work either. Still have to submit twice in order to get the message
- Code: Select all
<!-- Set to Handle Everything -->
<h3>Flash Message: <cms:get_flash 'flash_msg' /></h3>
<!-- Set to Handle Everything -->
<!-- EXTENDED FORM -->
<cms:form id="contactForm" action="" method="POST" anchor="0">
<!-- Handle Everything -->
<cms:if k_error >
<cms:set_flash name='flash_msg' value="Your submission failed!" />
</cms:if>
PS: I have no error in my console log and don't cache my pages (also no PrettyURL)