Forum Replies Created

Viewing 5 posts - 16 through 20 (of 20 total)
  • Author
    Posts
  • in reply to: Build a Contact Form with Piklist 0.9.9.6? #5270
    Marc
    Member

    Well, 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
      }
    
    in reply to: Build a Contact Form with Piklist 0.9.9.6? #5269
    Marc
    Member

    I 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 form
    

    Is 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.

    in reply to: Build a Contact Form with Piklist 0.9.9.6? #5267
    Marc
    Member

    Hi there,

    Just encountered the same problem.
    I looked around, and if in class-piklist-form.php line 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!

    in reply to: two questions about shortcodes #5155
    Marc
    Member

    That’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!

    in reply to: [Feature Request] Add Class attribute for metabox #3659
    Marc
    Member

    Ok that makes sense 🙂
    Looking forward to trying the next release.

    Thanks for the great work and great support @Steve!

Viewing 5 posts - 16 through 20 (of 20 total)