I have a Laravel project. Not done by me. But I'm managing the application now. I have faced a problem in the project. Need to remove some validation. To make a mandatory project optional. Here's the view file.
{!! Form::open(array('url' => 'service/tripbuddy', 'method' => 'POST', 'id' => 'frm_trip_package')) !!}
This is the blade template for form. And this is the HTML input I need to remove required validation part.
<div class="form-group col-md-3 col-sm-12">
<label>Number of People <span class="required">*</span></label>
<input class="form-control" name="no_of_people" id="no_of_people" type="number"
value="">
</div>
And also I found this javascript code also related to the validation process. But I changed that. Nothing happened.
var validator = new FormValidator('frm_trip_package', [{
name: 'title',
display: 'Title',
rules: 'required|max_length[50]'
},{
name: 'description',
display: 'Description',
rules: 'required|max_length[2500]|min_length[90]'
}, {
name: 'no_of_people',
display: 'Number of people',
rules: 'required'
}, {
name: 'iteneries',
display: 'Itineraries',
rules: 'required'
}, {
name: 'method_of_travel',
display: 'Method of travel',
rules: 'required'
}, {
name: 'total_hours',
display: 'Total Hours',
rules: 'required'
}, {
name: 'total_minutes',
display: 'Total Minutes',
rules: 'required'
}, {
name: 'price',
display: 'Price',
rules: 'required|max_length[8]'
}, {
name: 'terms',
display: 'Terms',
rules: 'required'
}, {
name: 'images',
display: 'Images',
rules: 'required'
}, {
name: 'pricing_type',
display: 'Pricing Type',
rules: 'required'
}
], function (errors, event) {
if (errors.length > 0) {
var errorString = '<a href="#" class="close" onclick="hideTripErrorMessages()">×</a>';
for (var i = 0, errorLength = errors.length; i < errorLength; i++) {
if (errors[i].name == 'images') {
errors[i].message = 'Please add images to your package';
}
errorString += errors[i].message + '<br />';
}
$("#trip_error_box").show();
$("#trip_error_box").html(errorString);
}
});
Is this a standard way of validating ? Can someone please tell me.
via Chanaka De Silva