Tagged: ,

Viewing 4 reply threads
  • Author
    Posts
    • #3344
      izeut
      Member

      Hey,
      I’m tryin to validate my fields created in metaboxes with piklist. For example, I have this field :

      piklist('field', array(
      	'type' => 'text',
      	'field' => 'field_nombre_billets',
      	'label' => 'Nombre de billets disponibles',
      	'description' => 'Capacité maximale 500 places',
      	'help' => 'Entrez le nombre de billets disponible pour ce spectacle',
      	'attributes' => array(
      		'class' => 'nombre_billets'
      		),
      	'validate' => array(
      		array(
      			'type' => 'limit',
      			'options' => array(
      				'min' => 1,
      				'max' => 500
      				)
      			),
      			'message' => 'Veuillez entrer un chiffre entre 1 et 500'
      		)
      	));
      

      Ok, I think my syntax is good. However, the validation doesn’t work. Do you know why? Am I doing something wrong?
      Sorry for my english 🙂

      Tristan

    • #3346
      Steve
      Keymaster

      @izeut– Welcome to the Piklist community!

      You format is perfect… you’re just using the wrong validation function. Try replacing limit with range. Here’s a list of the validation functions in Piklist and their descriptions.

    • #3347
      Steve
      Keymaster

      @izeut– Also, instead of using a custom message in another language, would you like to help translate Piklist into your language?

    • #3351
      izeut
      Member

      Ok thanks for the answer.
      Yes I can help you for that if you want.

    • #3355
      Steve
      Keymaster

      @izeut– I just sent you an invite to join our translation team. Email me at [email protected] if you have any questions. Thank you so much for your help!

Viewing 4 reply threads
  • The topic ‘validation doesn't work’ is closed to new replies.