Viewing 19 reply threads
  • Author
    Posts
    • #4887
      ndbe
      Member

      I got this field:

      piklist('field',array(
          'type'=>'hidden',
          'field'=>'latLng'
      
      ));
      

      And I can access this value from front but in the admin side the field gives me an error:

      <input type="hidden" id="_post_meta_latLng_0" name="_post_meta[latLng]" value="
      Notice: Array to string conversion in [...]/wp-includes/formatting.php on line 959
      Array" class="_post_meta_latLng piklist-field-element" data-piklist-field-addmore-clear="0">

      I checked DB and the values in tables are correct. Exemple value saved in DB:
      53.45258580956264,14.464406390869158

    • #4889
      ndbe
      Member

      After changing to:

      piklist('field',array(
          'type'=>'text',
          'field'=>'latLng'
      
      ));

      everything works fine.

    • #4890
      Steve
      Keymaster

      @ndbe– I was able to reproduce the error. We’ll fix in the next version of Piklist

      Also, you need to pass a value to a hidden field:

      piklist('field',array(
          'type'=>'hidden',
          'field'=>'latLng',
          'value' => 'hello'
      
      ));
      
    • #4911
      Steve
      Keymaster

      This will be fixed in Piklist v0.9.9.7

    • #5926
      kplaneta
      Member

      Update in 0.9.9.7 fixed nothing. Whenever I save anything into a hidden field I get “Array” in its value.

    • #5961
      Steve
      Keymaster

      You’re passing a value and just getting an empty array?

    • #5968
      kplaneta
      Member

      Take a look at the vid > https://dl.dropboxusercontent.com/u/16604210/Hidden-saved-as-array.wmv

      By positioning the marker on the map the value of the hidden field changes. When I save the page, the value in this field is “Array”.

    • #5972
      Steve
      Keymaster

      Can you post your field code? Is 'add_more' => true set?

    • #5973
      kplaneta
      Member

      Add more is not set. The field code is

      piklist('field',array(
           'type' => 'hidden'
          ,'field' => $prefix . 'latLang'
          ,'value' => '53.010272, 18.605023'
      	,'attributes' => array(
      		'maxlength' => 50
      	)
      	,'validate' => array(
      		array(
      			'type' => 'limit'
      			,'options' => array(
      				'max' => 50
      			)
      		)
      	)
      ));
    • #5974
      kplaneta
      Member

      Oh, I forgot to mention that I tried removing “attributes” and “validate”, but the effect was exactly the same.

    • #5975
      Steve
      Keymaster

      Can you email the entire meta box to [email protected] ?

    • #5983
      kplaneta
      Member

      Done.

    • #5994
      Steve
      Keymaster

      @kplaneta– Thanks for sending the file. We need to look into this further.

    • #6021
      kplaneta
      Member

      Hi. I’m just wondering if you’ve successfully diagnozed the problem or were able to reproduce the error. I may just add that just like in @ndbe’s case after switching field type to “text” everything started working.

    • #6047
      Steve
      Keymaster

      @kplaneta– This is on our bug list and will be squashed in the next version of Piklist.

    • #6946
      Tonny Keuken
      Member
      This reply has been marked as private.
    • #6947
      Tonny Keuken
      Member
      This reply has been marked as private.
    • #6954
      Steve
      Keymaster

      @tonnykeuken– This is fixed in the next major version.

      Posting your fix here for other:

      In the “piklist” plugin folder go to: plugins/piklist/parts/fields/hidden.php, and change the line (6):
      from: value=””
      to: value=”

    • #7297
      vayu
      Member

      Hi Steve.
      When I download the latest version of Piklist v0.9.9.9 I see that the hidden field value is still not fixed.
      It still returns:
      value="<?php echo esc_attr($value); ?>"
      and not
      value="<?php echo is_array($value) ? esc_attr(end($value)) : esc_attr($value); ?>"

      Should it not do that or do a have a reason for not implementing this after all?

    • #7298
      vayu
      Member

      Oh, it just occurred to me that maybe you wrote this, when it was on version v0.9.9.9. If so, then I will edit the file myself and look forward to the next major release. 😉

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