Tagged: ,

Viewing 1 reply thread
  • Author
    Posts
    • #5750
      mcmaster
      Member

      My client wants to be able to print out some information, so I’m using a really simple front-end form just to find out what she wants to print. I don’t need to save anything to the database; I just want to collect the info via $_POST.

      Here’s the form:

      <?php
      /*  
      Title: Print Orders
      Method: post
      Message: Printing Orders
      */
      
      /**
       *   The shortcode for this form is:
       *   [piklist_form form="print-orders" add_on="mcw-post-custom"]
       */
      
      piklist('field', array(
         'type' => 'radio',
         'scope' => 'post_meta',
         'field' => 'selection',
         'label' => 'Select your report:',
         'choices' => array(
            'summaries' => 'Display a summary of all orders',
            'printable' => 'Display all orders in printable format',
            'single' => 'Print a single order in printable format',
         ),
      ));
      
      piklist('field', array(
         'type' => 'text',
         'scope' => 'post_meta',
         'field' => 'order_id',
         'label' => 'Order number: ',
         'conditions' => array(
            array(
               'scope' => 'post_meta',
               'field' => 'selection',
               'value' => 'single',
            ),
         ),
      ));
      
      // Submit button
      piklist('field', array(
         'type' => 'submit',
         'field' => 'submit',
         'value' => 'Print Orders',
         'attributes' => array(
            'class' => 'btn btn-primary',
         )
      ));
      

      I added the scope fields as without them I couldn’t use the condition for order_id.

      Problem: when I submit the form, I get the following order message:

      
      Notice: Undefined index: post in /Users/donna/Sites/bentonswcd/wp-content/plugins/piklist/includes/class-piklist-form.php on line 3028
      

      I’m running Piklist 0.9.9.6, and that line is:

      
      $field['object_id'] = $field['object_id'] ? $field['object_id'] : $object_ids[$meta_type];
      

      I’m really baffled. If I change the post comments to use Method: get instead of post, I don’t get the error message but I get a really ugly URL.

      Any clues where I’m goofing up?

      Thanks!
      Donna

    • #5751
      jivedig
      Member

      Just jumping in as I’ve been playing with forms quite a bit lately. Try setting the scope to a random string (the same for each). That will allow you to do whatever you want with the data (or in your case, not save it anywhere.

Viewing 1 reply thread
  • You must be logged in to reply to this topic.