Tagged: ,

Viewing 2 reply threads
  • Author
    Posts
    • #11381
      ramzi
      Participant

      I tried the checlist field with the following code:

      piklist('field', array(
          'type' => 'checkbox',
          'field' => 'my_checkbox',
          'label' => 'Checkbox',
          'value' => 'third', // set default value
          'choices' => array(
            'first' => 'First Choice',
            'second' => 'Second Choice',
            'third' => 'Third Choice'
          )
        ));

      When I see the code from the browser, I found the following result:

      <li>    
            <label class="piklist-field-list-item">  
              <input 
                type="checkbox"
                id="my_checkbox_0" 
                name="my_checkbox[]"
                value="first"
                          class="my_checkbox piklist-field-type-checkbox piklist-field-element"         />         
                <input 
                  type="hidden"
                  id="my_checkbox_0" 
                  name="my_checkbox[]"
                  value=""
                />
            
                      
              <span class="piklist-list-item-label">
                First Choice        </span>
          
            </label>
        
          </li>

      There is a hidden field come out from the code. What should I do to correct this?

    • #11382
      Steve
      Keymaster

      @ramzi– that field belongs there. It allows Piklist to save checkbox data without saving extra metadata.

    • #11383
      ramzi
      Participant

      OK, noted.
      Thanks you, Steve.

Viewing 2 reply threads
  • You must be logged in to reply to this topic.