This topic contains 6 replies, has 3 voices, and was last updated by Truong Giang 1 year, 6 months ago.
- Topic
Hello,
When fields are in a group, the validation does not works.
For example, in the metabox below :
– the litte red star displays next “Légende et crédits de la vidéo” (that’s ok)
– the post can be publish even when “vm_video_legend” is empty
– “vm_video_link” displays the english validation message “Please enter a valid URL.” instead of mine “Ce champ doit être une url valide”.$meta_boxes[] = array( 'title' => __( 'La résidence', 'vm' ), 'post_types' => array( 'residence' ), 'context' => 'normal', 'priority' => 'high', 'id' => 'vm_residence', 'fields' => array( array( 'name' => __( 'Vidéo', 'vm' ), 'id' => 'vm_video_group', 'type' => 'group', 'fields' => array( array( 'name' => __( 'Lien de la vidéo (Youtube, Vimeo)', 'vm' ), 'id' => 'vm_video_link', 'type' => 'oembed', ), array( 'name' => __( 'Légende et crédits de la vidéo', 'vm' ), 'id' => 'vm_video_legend', 'type' => 'text', ), ), ), ), 'validation' => array( 'rules' => array( 'vm_video_group' => array( "vm_video_link" => array( 'url' => true, ), "vm_video_legend" => array( 'required' => true, ), ), ), 'messages' => array( 'vm_video_group' => array( "vm_video_link" => array( 'url' => __( 'Ce champ doit être une url valide', 'vm' ), ), "vm_video_legend" => array( 'required' => __( 'Ce champ est requis', 'vm' ), ), ), ), ), );
I also tried to define validation rules and messages like below with no success
<?php 'validation' => array( 'rules' => array( 'vm_video_group' => array( "vm_video_link" => array( 'url' => true, ), "vm_video_legend" => array( 'required' => true, ), ), ), 'messages' => array( 'vm_video_group' => array( "vm_video_link" => array( 'url' => __( 'Ce champ doit être une url valide', 'vm' ), ), "vm_video_legend" => array( 'required' => __( 'Ce champ est requis', 'vm' ), ), ), ), ), ?>
Can you fix this please ?
Regards,
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
You must be logged in to reply to this topic.