Viewing 3 reply threads
  • Author
    Posts
    • #1673
      Jason
      Keymaster

      I found a strange bug today. Take a look at this:

      piklist('field', array(
      	'type'		=> 'number',
      	'field'		=> 'price',
      	'label'		=> __('Price ($)'),
      	'attributes'=> array(
      		'placeholder'		=> 'Free',
      		'pattern'		=> '[0-9]+([\,|\.][0-9]+)?',
      		'step'			=> 0.01,
      		'min'			=> 0
      	)
      ));
      

      So I’m using the number field, which applies a default value of 1 to the step and min attributes. This works fine. But, if I change the min attribute, as I’m doing above, if actually removes the attribute from the element. I’ve checked the inspector. If I remove the ‘min’ => 0 line, it has a min of 1; if I leave it, there’s no min.

      After a brief digging, I found line 1741 in class-piklist-form and changed it to the following:

      if (isset($value) && ($value !== '') && !in_array($key, $exclude))

      That made sure it’s not an empty string (which would produce a “=value”), it’s set, and it’s not null. Otherwise it didn’t accept a value of 0.

      Hope this helps!

    • #1674
      Jason
      Keymaster

      I made a pull request for this.

    • #1676
      Steve
      Keymaster

      @jason– Nice find and great fix. I just included it in the next version of Piklist.

      Question: where did you make the pull request to?

    • #1680
      Jason
      Keymaster

      Thanks! Glad to help!

      So.. it turns out that the wp-plugins/anything on github is just a mirror of the plugins available from WP. Making a pull-request there does absolutely nothing. 🙂

      Is the only way to contribute to Piklist through svn, currently?

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