Tagged: , ,

Viewing 5 reply threads
  • Author
    Posts
    • #4058
      bicho44
      Member

      Hi: I need a ‘price’ field, but i cannot put a number field with the comma separated values.
      The ‘Step’ value is not affected.

      piklist (
          'field',
          array(
              'type' => 'number',
              'scope' => 'post_meta',
              'field' => 'precio_barco',
              'label' => __('Precio', 'imgd'),
              'value' => '',
              'step' => '0.01',
              'attributes' => array(
                  'class' => 'text'
              ),
              'position' => 'wrap'
          )
      );

      Any Ideas?

      As always, thanks in advance.

      Fede

    • #4059
      Steve
      Keymaster

      The step parameter belongs within the attributes array. Let us know if that works.

    • #4065
      bicho44
      Member

      Hi: I tried that too (i forgot to put it at the example), but dont work either.

      Thanks in advance
      Fede

      Update
      Now is working, sorry for this

    • #4066
      bicho44
      Member

      Update 2: eXtrange behaviour 😀
      If you already have a integer number loaded in the field the step parameter in the definition is ignored and you can only put integers numbers.

      But if you delete the values, and save the post, and then re-open the post, you can put float numbers

      Weird, hu?

      Regards from Bariloche, Patagonia
      Fede

    • #4069
      Steve
      Keymaster

      The number fields is an HTML5 field, not a Piklist field. Piklist just makes it easy for you to implement. It looks like you need to set the min attribute as well:

      piklist (
        'field',
        array(
          'type' => 'number',
          'scope' => 'post_meta',
          'field' => 'precio_barco',
          'label' => __('Precio', 'imgd'),
          'value' => '',
          'attributes' => array(
              'class' => 'text',
              'step' => '0.01',
              'min' => '0.00'
          )
        )
      );
      
    • #4074
      bicho44
      Member

      Ok, i gonna do that

      We have to put that in the docs 😀

      Again thanks
      Fede

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