redux-framework icon indicating copy to clipboard operation
redux-framework copied to clipboard

Field is required documentation

Open Zigson opened this issue 12 years ago • 21 comments

Hi,

is there a documentation for required option?

Zigson avatar Jan 29 '14 20:01 Zigson

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

dovy avatar Jan 29 '14 21:01 dovy

This is just great. Thanks.

Zigson avatar Jan 29 '14 21:01 Zigson

You're welcome.

dovy avatar Jan 29 '14 21:01 dovy

Shouldn't just be: if field is required and being empty, then show error? :)

Zigson avatar Jan 29 '14 21:01 Zigson

? Just set the value to empty, right? Or did you find a bug?

dovy avatar Jan 29 '14 22:01 dovy

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?

Zigson avatar Jan 29 '14 22:01 Zigson

You want it to hide or show on empty? This will show it only when it's empty.

dovy avatar Jan 29 '14 22:01 dovy

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?

Zigson avatar Jan 29 '14 22:01 Zigson

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.

dovy avatar Jan 29 '14 22:01 dovy

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.

Zigson avatar Jan 29 '14 22:01 Zigson

You're most welcome. I could make a not_empty validation real quick if you wish.

dovy avatar Jan 29 '14 22:01 dovy

If this is not too big effort for you, please. I guess I will not be last person who will use this.

Zigson avatar Jan 29 '14 22:01 Zigson

Just pushed a new validation called not_empty. Have a great day.

dovy avatar Jan 29 '14 22:01 dovy

And "required" function is ajax driven, nice!

Zigson avatar Jan 29 '14 23:01 Zigson

@dovy how do I call new validation? 'validate' => 'not_empty' does not seem to work

Zigson avatar Jan 29 '14 23:01 Zigson

I believe it's validation. Should make both keys work through.

dovy avatar Jan 29 '14 23:01 dovy

Hm, the field is empty, after save still no error notice.

Any more clues?

Zigson avatar Jan 29 '14 23:01 Zigson

@dovy I have checked again, 'validate' => 'not_empty' is not working, will you be able to check it please?

Zigson avatar Jan 30 '14 20:01 Zigson

Pull 3.1.5.7 and give it a try. Repoen if there is a problem.

kprovance avatar Feb 05 '14 22:02 kprovance

@kprovance fully working, thank you.

Zigson avatar Feb 07 '14 17:02 Zigson