[eluser]DocFunky![/eluser]
I'm setting up a cart where the user can update the quantity. Because I don't know aJAX to do it instantly, I'm looking to do it in full php with a refresh cart.( you can still se my post where I try to set it up with AJAX)
The thing is that there is a form below the cart and when the user change the quantity (into an input) he has to click on 'refresh' or 'recalculate', whatever.
So my problem is I get the validation process running as the re-calculate is like a submit button ( the price is calculated at the begining of the form method) because the user modified an input, and for all the fields that has not been filled yet, I got an error.
How can I say "If the user click on refresh, don't submit the form to the validation process, just take that input in consideration" ? I don't know if it is possible to have 2 separated forms on the same page ? (they are inside each other)
I give a part of my form, I need to listen to the
> form_dropdown('quantity'.$product['title'], $options,$value[$product['title']],$data0);
when I want to update the quantity, and only this one.
Code:
<ul class="form">
<li>
<h2>Your Information</h2>
</li><li>
<ul class="form" id="threeColumns">
<li>
<?php
echo form_open('main/Form');
echo form_label('First Name', 'firstname');
echo ' :</br>';
if(set_value('firstname')){
$valuefirstname= set_value('firstname');
}else{
$valuefirstname= $this->session->userdata('firstname');
}
echo form_input('firstname', $valuefirstname);
echo form_error('firstname');
echo '</li><li>';
echo form_label('Last Name', 'lastname');
echo ' :</br>';
if(set_value('firstname')){
$valuelastname= set_value('lastname');
}else{
$valuelastname= $this->session->userdata('lastname');
}
echo form_input('lastname', $valuelastname);
echo form_error('lastname');
echo '</li><li>';
echo form_label('Email', 'email');
echo ' :</br>';
if(set_value('firstname')){
$valueemail= set_value('email');
}else{
$valueemail= $this->session->userdata('email');
}
echo form_input('email', $valueemail);
echo form_error('email');
?>
<div class="fError Right">
<?php if(ISSET($error) AND $error !=NULL)
echo $error;
?>
</div>
</li>
</ul>
</li>
<div class="break">
</div>
<li id="Payment">
<div id='Table'>
<table>
<tr>
<th id="top-left">
Product
</th>
<th>
Color
</th>
<th>
Quantity
</th>
<th>
Price Per Product
</th>
<th id= "top-right">
Total
</th>
</tr>
<?php
foreach ($products as $product) {
?>
<tr class="line">
<td>
<img id="tableImage" src="<?php echo base_url($product['image_url'])?>" alt="product" width="121" />
</td>
<td>
<?php echo $product['title'] ?>
</td>
<td>
<?php
$options = array(
'0' => '0',
'1' => '1',
'2' => '2',
'3' => '3',
'4' => '4',
'5' => '5',
'6' => '6',
'7' => '7',
);
if($product['quantity']==0){
$value[$product['title']] = set_value('quantity'.$product['title']);
}else{
$value[$product['title']] = $product['quantity'];
}
$data0 = 'class="quantSelect" value="'.$value[$product['title']].'" id="quant'.$product['title'].'"';
echo form_dropdown('quantity'.$product['title'], $options, $value[$product['title']],$data0);
?>
</td>
<td>
<?php echo $product['price'] ?>
</td>
<td id="<?php echo 'price'.$product['title']?>">
$<?php echo $total[$product['title']] ?>
</td>
</tr>
<?php
}
?>
Tnanks