I am getting all other input data in Controller and storing them in database but I have Total in input field but I am unable to get that data in Controller. Difference between Total and other input field is that, I am getting Total using javascript. Anyone where I am getting wrong, I think I am not giving correct name in Controller.
checkout.blade.php
<div class="row">
{!! Form::open(['route'=>'address.store','method'=>'post'])!!}
<tr class="order-total">
<th>Total</th>
<td>
<strong>
<span class="woocommerce-Price-amount amount">
<span class="woocommerce-Price-currencySymbol">PKR.
<input style="border: none; background-color: #FFFFFF" id="Total" name="Total" disabled title="Total"></span>
</span>
</strong>
</td>
</tr>
{!! Form::close() !!}
<script>
$(document).ready(function(){
var span_Text = document.getElementById("SubT").innerHTML;
var del1 = 150;
var Total=+del1 + +span_Text;
$("#delivery").html(del1);
$("#note").html('Note: Delivery Charges will be Rs.150/-');
$("#Total").val(Total);
$('#location').change(function(){
var x = ($(this).val());
if(x === 'Other'){
if(span_Text >= 1500){
$('.formx').show();
var del2=200;
var Total1=+del2 + +span_Text;
$("#delivery").html(del2);
$("#note").html('Note: All Other Location Delivery Charges will be Rs.200/- and Order must of Rs.1500/-');
$("#Total").val(Total1);
}
else{
alert('Order must of Rs.1500/-');
$("#note").html('Note: All Other Location Delivery Charges will be Rs.250/- and Order must of Rs.1500/-');
}
}
else {
var Total2=+del1 + +span_Text;
$('.formx').hide();
$("#delivery").html(del1);
$("#note").html('Note: Delivery Charges will be Rs.150/-');
$("#Total").val(Total2);
}
});
});
</script>
Controller.php
public function store(Request $request)
{
$this->validate($request,[
'fname'=>'required',
'lname'=>'required',
'Ttl'=>'required',
'email'=>'required|email',
'addressline'=>'required',
'city'=>'required',
'pro'=>'required',
'phone'=>'required |regex:/^[0-9\-\+]{9,15}$/',
'Total'=>'required'
//(0)[0-9]{9}
//|regex:/^[0-9\-\+]{9,15}$/
]);
Address::create($request->all());
return redirect('/')->with('valPrev',1);
}
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2oD9d4x
via IFTTT
Aucun commentaire:
Enregistrer un commentaire