salve a tutti, come scritto nel titolo del post, ho il problema di conflitto tra form.
ho modificato un piccolo script (sicuramente molto rudimentale) che mi permette di moltiplicare il prezzo di un articolo per la quantità degli articoli selezionati tramite menu a tendina...
codice:
<script type="text/javascript"> function calcolatotale() {
var a = document.forms[0].quantita.options[document.forms[0].quantita.selectedIndex].text; var b = document.forms[0].costo.value;
var c = a * b; document.forms[0].IMPORTO.value= parseFloat(c).toFixed(2).replace('.',',');
var a = document.forms[1].quantita.options[document.forms[1].quantita.selectedIndex].text; var b = document.forms[1].costo.value;
var c = a * b; document.forms[1].IMPORTO.value= parseFloat(c).toFixed(2).replace('.',',');
var a = document.forms[2].quantita.options[document.forms[2].quantita.selectedIndex].text; var b = document.forms[2].costo.value;
var c = a * b; document.forms[2].IMPORTO.value= parseFloat(c).toFixed(2).replace('.',',');
var a = document.forms[3].numero.options[document.forms[3].numero.selectedIndex].text; var b = document.forms[3].costo.value;
var c = a * b; document.forms[3].IMPORTO.value= parseFloat(c).toFixed(2).replace('.',',');
}
function cancella() {
document.forms[0].IMPORTO.value= parseFloat(c).toFixed(2).replace('.',','); document.forms[0].numero.selectedIndex=0;
}
</script>
e poi richiamo la funzione in tanti form nella pagina.
codice:
<form style="float:right; text-align:center; margin-left:-30px;" method="post" action="../../riepilogo-acquisti.php" name="form3" id="form3">
<input type="hidden" name="otto" value="008">
<input type="hidden" name="descrizione" value="Amativo Salento I.G.T.">
[img]../../prezzi/13-50.png[/img]
<input name="costo" type="text" value="13.50" readonly="readonly" size="2" maxlength="4" style="display:none;"> quantità
<select size="1" name="numero" onchange="calcolatotale();">
<option selected="selected" value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
</select>
Tot. € <input name="IMPORTO" type="text" value="13,50" readonly="readonly" id="IMPORTO" size="4" maxlength="5">
<input type="image" src="../../../images/shopping_bag.png" name="B1" value="invia">
</p>
</form>
Il conflitto lo sto rilevando adesso, ora che ho inserito nella pagina un form per fare delle ricerche interne al sito, (non progettato da me, ma uso quello di freefind)
Ora, la ricerca funziona, ma le varie moltiplicazioni invece no.... cosa devo o posso modificare per risolvere?
OPS...
il form per le ricerche è questo
codice:
<form id="ffresult_sbox0" style="margin:0px; margin-top:4px;" action="http://search.freefind.com/find.html" method="get" accept-charset="utf-8" onsubmit="ffresults.show(0);">
<input type="hidden" name="si" value="46587431"> <input type="hidden" name="pid" value="r">
<input type="hidden" name="n" value="0"> <input type="hidden" name="_charset_" value=""> <input type="hidden" name="bcd" value="÷"> <input type="hidden" name="sbv" value="j1">
<input type="text" name="query" size="12">
<td style="width:70px;"><input type="image" src="../../../images/search.png" name="cmdcerca" value="Cerca" height="35" width="70"></td>
</form>
grazie a tutti per l'aiuto.... magari se fosse possibile avere un suggerimento per sistemare lo script del calcolatotale