Viewing 1 reply thread
  • Author
    Posts
    • #3682

      bug : when the group field have a field with conditions. (parent level 1).

      piklist('field', array(
      		'type' => 'group'
      		,'field' => 'auth_settings'
      		,'label' => __('Settings')
      		,'add_more' => false
      		,'fields' => array(
      				array(
      					'type' => 'hidden'
      					,'field' => 'authenticated'
      					,'value' => 'false'
      				),
      				array(
      					'type' => 'radio'
      					,'field' => 'steps'
      					,'value' => 'step2'
      					,'choices' => array(
      						'step1' => 'Step 1. Enter Your API Credentials'
      						,'step2' => 'Step 2. Select which services do you wish'
      						,'step3' => 'Step 3. Enter Access Code'
      					),'attributes' => array(
      						'class' => 'page_steps'
      					)
      				),
      				array(
      					'type' => 'group'
      					,'field' => 'credentials'
      					,'add_more' => false
      					,'fields' => array(
      						array(
      							'type' => 'text'
      							,'field' => 'user_id'
      							,'label' => 'ClientID:'
      							,'value' => ''
      							,'description' => 'ClientID:'
      						),
      						array(
      							'type' => 'text'
      							,'field' => 'client_secret'
      							,'label' => 'Client Secret:'
      							,'value' => ''
      							,'description' => 'Client Secret:'							
      						),
      						array(
      							'type' => 'text'
      							,'field' => 'api_key'
      							,'label' => 'Api Key:'
      							,'value' => ''
      							,'description' => 'Api Key:'
      						)
      					)
      				),
      				array(
      					'type' => 'checkbox'
      					,'field' => 'services'
      					,'value' => 'Analytics'
      					,'choices' => array(
      						'Analytics' => 'Google Analytics'
      						,'Calendar' => 'Google Calendar'
      						,'Drive' => 'Google Drive'
      					)
      				),
      				array(
      					'type' => 'text'
      					,'field' => 'auth_code'
      					,'label' => 'Authorization Code:'
      					,'description' => 'Authorization Code:'
      					,'help' => 'Paste here Access Code.'
      					, 'conditions' => array(
      						array('field' =>'auth_settings:steps', 'value' => 'step3')
      					)
      				)
      			)
      		)
      	);

      i solved with a modification on piklist.js line 550 and 554 changing (else if) statement to (if).

      before:

      `else if (!field.hasClass(‘piklist-field-condition’) && field.parents(‘.piklist-field-condition’).length > 0)
      {
      context = field.parents(‘.piklist-field-condition’);
      }
      else if (field.parents(‘div[data-piklist-field-group=”‘ + field.attr(‘data-piklist-field-group’) + ‘”]’).length)
      {
      context = field.parents(‘div[data-piklist-field-group=”‘ + field.attr(‘data-piklist-field-group’) + ‘”]’);
      }`

      after:

      `if (!field.hasClass(‘piklist-field-condition’) && field.parents(‘.piklist-field-condition’).length > 0)
      {
      context = field.parents(‘.piklist-field-condition’);
      }
      if (field.parents(‘div[data-piklist-field-group=”‘ + field.attr(‘data-piklist-field-group’) + ‘”]’).length)
      {
      context = field.parents(‘div[data-piklist-field-group=”‘ + field.attr(‘data-piklist-field-group’) + ‘”]’);
      }`

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

      @leonardotessaro– Thanks for the fix! We’ll review.

Viewing 1 reply thread
  • The topic ‘Bug Grouped field conditions’ is closed to new replies.