Tagged: 

Viewing 9 reply threads
  • Author
    Posts
    • #1732
      kattagami
      Member

      hello,

      I notice diffrent issues with the add_more fields:

      1- add_more doesn’t works with a html field.

      piklist( 'field', 
      	array(
      		'type'        => 'group',
      		'label'       => 'Evaluation',
      		'field'       => 'projets_evaluation_group',
      		'columns'     => 12,
      		'add_more'    => true,
      		'fields'      => array(
      				     array(
      					'type'        => 'html',
      					'value'		  => '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.<p>',
      					'columns' 	  => 12,
      										),
      				array(
      					'type'        => 'textarea',
      					'field'       => 'projets_evaluation_comment_1',
      					'columns' 	  => 12,
      										),
      					array(
      						'type'        => 'radio',
      						'field'       => 'projets_evaluation_question_1',
      						'value'       => '4', // Sets default to 4
      						'columns'     => 12,
      						'choices' 	  => array(
      															'10' => 'tout à fait d\'accord',
      															'8'  => 'd\'accord',
      															'6'  => 'ni en désaccord ni d\'accord',
      															'4'  => 'pas d\'accord',
      															'2'  => 'pas du tout d\'accord',
      														)
      								),
      					          
              					)
           )
      );

      2- If I put a textarea field to the end of an add_more group field, the textarea is not embed in the group fields.

      piklist( 'field', 
      	array(
      		'type'        => 'group',
      		'label'       => 'Evaluation',
      		'field'       => 'projets_evaluation_group',
      		'columns'     => 12,
      		'add_more'    => true,
      		'fields'      => array(
      					array(
      						'type'        => 'radio',
      						'field'       => 'projets_evaluation_question_1',
      						'value'       => '4', // Sets default to 4
      						'columns'     => 12,
      						'choices' 	  => array(
      															'10' => 'tout à fait d\'accord',
      															'8'  => 'd\'accord',
      															'6'  => 'ni en désaccord ni d\'accord',
      															'4'  => 'pas d\'accord',
      															'2'  => 'pas du tout d\'accord',
      														)
      								),
      					array(
      						'type'        => 'textarea',
      						'field'       => 'projets_evaluation_comment_1',
      						'columns' 	  => 12,
      										),
      					          
              					)
           )
      );

      3- With repeating textarea, there are some differences in the way they are displayed.

      piklist( 'field', 
      	array(
      		'type'        => 'group',
      		'label'       => 'Evaluation',
      		'field'       => 'projets_evaluation_group',
      		'columns'     => 12,
      		'add_more'    => true,
      		'fields'      => array(
      					array(
      						'type'        => 'textarea',
      						'field'       => 'projets_evaluation_comment_1',
      						'columns' 	  => 12,
      										),
      					array(
      						'type'        => 'radio',
      						'field'       => 'projets_evaluation_question_1',
      						'value'       => '4', // Sets default to 4
      						'columns'     => 12,
      						'choices' 	  => array(
      															'10' => 'tout à fait d\'accord',
      															'8'  => 'd\'accord',
      															'6'  => 'ni en désaccord ni d\'accord',
      															'4'  => 'pas d\'accord',
      															'2'  => 'pas du tout d\'accord',
      														)
      								),
      					          
              					)
           )
      );

    • #1735
      Steve
      Keymaster

      This is a known bug > . Though Add-mores save data correctly, we are still working on presentation.

    • #1739
      kattagami
      Member

      You’re right for the third point, I didn’t see this post 😉

      And for the two first point:

      1- add_more doesn’t works with a html field.
      2- If I put a textarea field to the end of an add_more group field, the textarea is not embed in the group fields.

      Can you reproduce these bugs or is it specific to my environment?

    • #1807
      kattagami
      Member

      add_more doesn’t works with a ‘File’ type field too.

      So to recap, at the moment, we can’t use the following type fields in an add_more:

      – Edit
      – textarea
      – html
      – file

      These fields display outside the add-more box and don’t repeat when we click on the “+” button.
      Hope you will find a solution to integrate these fields in add-more in the next release 😉

    • #5316
      Marc
      Member

      Hi there,
      Sorry to revive an old subject.
      I’m trying to add a button field with add_more, but on pressing the + button, the javascript removes the value of the new button, hence removing its text.
      I believe it would make sence to change in piklist.js line 1327

      
                          if (!$(this).is(':checkbox, :radio'))
                          {
                            $(this).removeAttr('value');
                          }
      

      to

      
                          if (!$(this).is(':checkbox, :radio, :button'))
                          {
                            $(this).removeAttr('value');
                          }
      

      maybe even adding a class like .no-reset-on-repeat if (!$(this).is(':checkbox, :radio, :button, .no-reset-on-repeat')) would allow flexibility for fields that could be repeated with the same value.

      Marc.

    • #5317
      Steve
      Keymaster

      @marcusig– Are you using the new beta? It should work fine now.

      • #5319
        Marc
        Member

        I wasn’t, I was using 0.9.9.6
        But after updating to 0.9.9.7, I encounter the same problem.
        The value is correct if I save, but JS that duplicates the fields removes all values except for :checkbox and :radio, and not :button
        piklst.js – line 1327

                            if (!$(this).is(':checkbox, :radio'))
                            {
                              $(this).removeAttr('value');
                            }
        

        So if I add :button after :radio, it works perfectly.

        Attachments:
        You must be logged in to view attached files.
    • #5332
      Steve
      Keymaster

      @marcusig– Can you post your field code so we can see how you created the button field?

    • #5339
      Marc
      Member

      Here it is:

      
      piklist('field', array(
      	'type' => 'group'
      	,'field' => 'section_builder'
      	,'template' => 'field'
      	,'fields' => array(
      		array(
      			'type' => 'group'
      			, 'field' => 'section_group'
      			, 'add_more' => true
      			, 'fields' => array(
      				array(
      					'type' => 'button'
      					,'field' => 'section_add_btn'
      					,'label' => 'A label'
      					,'attributes' => array(
      						'value' => 'The Button'
      						,'class' => 'button'
      					)
      				)
      				, array(
      					'type' => 'hidden'
      					,'field' => 'section'
      				)
      			)
      		)
      	)
      ));
      
      

      I tried with the button field on its own and add more and the same happens:

      piklist( 'field', array(
      		'type' => 'button'
      		,'field' => 'section_add_btn'
      		,'label' => 'Add a section'
      		,'add_more' => true
      		,'attributes' => array(
      			'class' => 'button'
      		)
      	)
      );
      

      The JS code in piklist/parts/js/piklist.js clearly removes the value parameter.
      This file piklist/parts/js/piklist.js downloaded from the trunk says it’s been modified in october. So maybe something is not up to date?

    • #5340
      Marc
      Member

      I wanted to create a custom field with some custom JS and functions, but when I tried something simple the add_more didn’t work. So I tried with the already existing fields.

    • #5341
      Marc
      Member

      I just had an idea and tried this instead, in a custom field:

      
      <a href="#" class="button">My button</a>
      <input 
        type="hidden"
        id="<?php echo piklist_form::get_field_id($arguments); ?>" 
        name="<?php echo piklist_form::get_field_name($arguments); ?>"
        value="<?php echo esc_attr($value); ?>" 
        <?php echo piklist_form::attributes_to_string($attributes); ?>
      />
      

      A button (not as a input) and a hidden input.
      The repeater works well, and it will probably allow me to do what I need to.

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