Forum Replies Created
-
AuthorPosts
-
MarcMemberWell, I’ve found a way to do it.
Here it is:
(all the code is in the form’s file)$form_id = $_POST['_']['form_id']; // if we don't have a form posted OR if the form posted contains errors: if( !$form_id || !empty( Piklist_Validate::notices( $form_id, true) ) ) { //display form piklist('field', array( 'type' => 'text ,'scope' => 'contact' ... )); .... } else { ?> <h3>Your request:</h3> <?php foreach( $_POST['_contact'] as $label => $value ) { echo '<p><strong>' . $label . ':</strong> ' . $value . '</p>'; } ?> <a href="<?= the_permalink(); ?>" class="btn btn-default">Go back to Contact form</a> <?php }
MarcMemberI have an other question concerning the frontend form, and in that case a Contact form.
I would like to change the content of the page if the submission is successful.For exemple
if(success) : Notice: Thank you for Your message. Whatever... Content of your message: ... ... [button Click here to go back to the form] else : display formIs there a way to do that?
I’ve found the elements necessary for that in the PiklistForm class, but the variables are private, so not accessible right now.
MarcMemberHi there,
Just encountered the same problem.
I looked around, and if inclass-piklist-form.phpline 3775 ->public static function notices
you add&& empty( Piklist_Validate::notices( self::$form_id, true) )in the if statement it sorts the problem.Full code:
public static function notices($form_id = null) { if (!empty(self::$form_submission) && self::$form_id && self::$form_id == $form_id && isset(self::$forms[self::$form_id]) && !empty(self::$forms[self::$form_id]['data']['message']) && empty( Piklist_Validate::notices( self::$form_id, true) ) // Checks if there are any errors ) { piklist::render('shared/notice', array( 'id' => 'piklist_form_notice' ,'notice_type' => 'update' ,'dismiss' => is_admin() ,'content' => self::$forms[self::$form_id]['data']['message'] )); } }At least it works for the frontend forms.
Not sure if it would have any effect somewhere else!
MarcMemberThat’s a great question!
I just tried to do the same today.
It would be an amazing feature, for exemple to make sliders or other repeatable content.
I’m working on a system to make easy content updates for complicated templates, and this would probably be one of the easiest way.
So I would be very interested to hear about this!
MarcMemberOk that makes sense 🙂
Looking forward to trying the next release.Thanks for the great work and great support @Steve!
-
AuthorPosts