lundi 8 juillet 2019

How to do hidden filed validation Laravel?

I am working in a module with Laravel and Vuejs where some fileds are by default hidden. And based on user action those hidden fields are unhide and showing as form input field. These hidden fields I need to do validate when user submit the form. Following is my Json Object for creating hidden input field:

customer_order_details:
    {
        payment_by: null,
    }

And Html input field in Vuejs is following:

And validation rules in Request controller is:

$rules = [
             'payment_by' => 'sometimes|required',

         ];

In the above configuration whenever I submit the form whatever 'payment_by' field hide/unhide always show validation error. But I need to show validation error only when 'payment_by' filed is unhide. Can anyone please help on it? Thanks in advance.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire