samedi 3 décembre 2016

Validation Issue in Select : Laravel 5.3

My Form is like below

<form method="POST" action="http://localhost:1234/Update" accept-charset="UTF-8">
    <input name="_token" type="hidden" value="bVyYZGPprZKHab8sQXairqhtwszTeQ36LRhp9u2k">
    <input type="hidden" name="_token" value="bVyYZGPprZKHab8sQXairqhtwszTeQ36LRhp9u2k">

    <select class="form-control" name="TypeID">
        <option value="-1">Please select Payment Type</option>
            <option value="2">Bitcoin</option>
            <option value="1">Paypal</option>
            <option value="3">Pioneer</option>
    </select>
    <button type="submit">Update</button>
</form>

Controller Action Method is like below

public function UpdatePaymentDetails(PaymentDetailsRequest $request) {
}

Request Class is below

class PaymentDetailsRequest extends Request {

    public function authorize()
    {
        return true;
    }

    public function rules() {
        return [
            'TypeID' => 'required|min:1',
        ];            
    }
}

What's the problem?

It is not validating when I don't selected TypeID, Am I missing something?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire