Field is required documentation
Hi,
is there a documentation for required option?
There is now. Been meaning to do it for some time. If you have any extra tips feel free to edit the wiki directly.
https://github.com/ReduxFramework/ReduxFramework/wiki/Required-Argument
This is just great. Thanks.
You're welcome.
Shouldn't just be: if field is required and being empty, then show error? :)
? Just set the value to empty, right? Or did you find a bug?
I am not sure.
array( 'id' => 'rat_slider_title_1', 'type' => 'text', 'title' => __('Title', 'rat_options_translations'), 'desc' => __('Enter title.', 'rat_options_translations'), 'required' => array('rat_slider_title_1','equals',''), 'default' => 'Right for your bussines', )
What am I doing wrong?
You want it to hide or show on empty? This will show it only when it's empty.
If the field is empty and user tries to post it, he should get the notice "field is required".
Am I mixing this with validation perhaps?
Indeed. Validation doesn't have a empty test. It could easily be built though. But that's what you're looking for, a validation.
Required is visibility of one field being dependent on the value of another.
I guess so, I used e.g. $username->setRequired(true) in Zend framework, so this got me off the track.
Ok, validation it is, thanks. I will look into it. Thank you for explaining.
You're most welcome. I could make a not_empty validation real quick if you wish.
If this is not too big effort for you, please. I guess I will not be last person who will use this.
Just pushed a new validation called not_empty. Have a great day.
And "required" function is ajax driven, nice!
@dovy how do I call new validation? 'validate' => 'not_empty' does not seem to work
I believe it's validation. Should make both keys work through.
Hm, the field is empty, after save still no error notice.
Any more clues?
@dovy I have checked again, 'validate' => 'not_empty' is not working, will you be able to check it please?
Pull 3.1.5.7 and give it a try. Repoen if there is a problem.
@kprovance fully working, thank you.