I was seeing through stackoverflow the solutions for this kind of problems but any of them are executing the code of javascript in the same session...please i want some help with this...i have this in my session
<script>
function show_alert()
{
var ProdAntes = document.getElementById("productoseleccionado").value;
var CantAntes = document.getElementById("cantidadantes").value;
var PrecAntes = document.getElementById("precioantes").value;
var FecAntes = document.getElementById("fechaantes").value;
var ProdAhora = document.getElementById("SoyaProductorProduccionProducto").value;
var CantAhora = document.getElementById("SoyaProductorProduccionCantidadtm").value;
var PrecAhora = document.getElementById("SoyaProductorProduccionPreciodolar").value;
var FecAhora = document.getElementById("select_date").value;
}
</script>
and in my html stuff i have this
<?php echo $this->Form->create('SoyaProductorProduccion');?>
<fieldset>
<?php
echo $this->Form->hidden('id', array('value' => $this->data['SoyaProductorProduccion']['id']));
echo $this->Form->input('operacion', array('type' => 'hidden', 'value'=>'Produccion'));
//--------------------------------------------------------------
$productoseleccionado = $this->data['SoyaProductorProduccion']['producto'];
echo $this->Form->input('productoseleccionado', array('type' => 'hidden','style'=>'width:500px; height:30px;','id' => 'productoseleccionado' , 'value' => $productoseleccionado));
echo $this->Form->input('producto', array(
'options' => array(
$productoseleccionado => $productoseleccionado,
'Torta solvente de soya' => 'Torta solvente de soya',
'Torta solvente de girasol' => 'Torta solvente de girasol',
'Harina integral de soya' => 'Harina integral de soya',
'Harina de girasol' => 'Harina de girasol',
'Cascarilla de soya' => 'Cascarilla de soya',
'Cascarilla de girasol' => 'Cascarilla de girasol',
'Aceite de soya refinado' => 'Aceite de soya refinado',
'Aceite de soya crudo' => 'Aceite de soya crudo',
'Aceite de girasol refinado' => 'Aceite de girasol refinado',
'Aceite de girasol crudo' => 'Aceite de girasol crudo',
),'label'=>'Tipo de Producto'
));
foreach ($soyacambiodolares as $soyacambiodolar):
$dolar=$soyacambiodolar['SoyaCambioDolar']['cambio'];
endforeach;
echo $this->Form->input('cambio', array('type' => 'hidden','value' => $dolar));
//-----------------------------------------------------------------------------
$cantidadantes = $this->data['SoyaProductorProduccion']['cantidadtm'];
echo $this->Form->input('cantidadantes', array('type' => 'hidden','style'=>'width:500px; height:30px;', 'value' => $cantidadantes,'id' => 'cantidadantes'));
echo $this->Form->input('cantidadtm', array('label' => 'Cantidad en tonelada(s) métrica(s) del producto (TM)','style'=>'width:500px; height:30px;'));
//-----------------------------------------------------------------------------
$precioantes = $this->data['SoyaProductorProduccion']['preciodolar'];
echo $this->Form->input('precioantes', array('type' => 'hidden','style'=>'width:500px; height:30px;', 'value' => $precioantes,'id' => 'precioantes'));
echo $this->Form->input('preciodolar', array('label' => 'Precio en Dolares Americanos por tonelada métrica (TM / $us)','style'=>'width:500px; height:30px;'));
//-----------------------------------------------------------------------------
?>
<table style="width: 600px">
<tr>
<td >
<?php
//----------------------------------------------------------------
$fechaantes = $this->data['SoyaProductorProduccion']['fecharegistro'];
echo $this->Form->input('fechaantes', array('type' => 'hidden','style'=>'width:500px; height:30px;', 'value' => $fechaantes, 'id' => 'fechaantes'));
//----------------------------------------------------------------
echo $this->Form->input("fecharegistro", array(
'label' => '<strong>Periodo al que corresponde la declaración</strong>', 'type' => 'text',
'style' => 'width: 110px',
'class' => 'fl tal vat w300p', 'error' => false , 'id' => 'select_date'));
?>
<?php echo $this->Html->div('datepicker_img w100p fl pl460p pa',
$this->Html->image('datepicker_calendar_icon.gif'),array('id' => 'datepicker_img'));
?>
<?php echo $this->Html->div('datepicker fl pl460p pa', ' ' ,array('id' => 'datepicker'));
?>
</td>
</tr>
</table>
<?php
echo $this->Form->submit('Modificar Existencia', array('class' => 'form-submit', 'title' => 'Presione aqui para agregar datos', 'onclick' => 'return show_alert();'));
?>
</fieldset>
<?php echo $this->Form->end(); ?>
my function is ok but i want these:
when i click the submit button i want to compare wich field had been changed, and i want to create a chain of detailed changes like "change in the field 1, change in the fiel 2.--" and so on...and this has to be saved in my database so i have to pass to a variable in my php before saving...thanks!