Back to top

Autore Topic: quanti calcoli può fare un form?  (Letto 1277 volte)

Offline nglca

  • Nuovo arrivato
  • *
  • Post: 32
    • Mostra profilo
quanti calcoli può fare un form?
« il: 13 Apr 2007, 17:49:54 »
ciao ragazzi mi spiego meglio.
ho creato un form per poter offrire un servizio di ritiro on line di capi da lavare (possiedo una lavanderia), prendendo come spunto il form pizza shop, ci ho sbattuto un po ma alla fine ho iniziato a capirci qualcosa. il mio problema è che avendo inserito molte caselle in cui digitare i numeri di capi (che a loro volta calcolano il prezzo equivalente per il numero inserito e alla fine della pagina riportano il totale in euro), non mi calcola il totale o meglio le prime 13 caselle nello script "totale" fa il calcolo e tutto ok, ma alla 14sima il calcolo non lo esegue più (per meglio spiegarmi vi posto il link  http://www.nglca.altervista.org/index.php?option=com_facileforms&Itemid=32 ). la 13sima casella corisponde a "piumone matrimoniale €. 18,00)
inoltre nel totale l'importo viene visualizzato con il punto: € 2.1 invece di € 2,10.
la mie domande sono:
1. come fare per poter eseguire il calcolo di tutte le voci?
2. come fare perchè nel totale si visualizzi l'importo con la virgola e i 2 decimali?
spero di essermi spiegato bene.
aspetto fiducioso nelle Vs. risp.
Grazie Angelo

Offline napo

  • Instancabile
  • ******
  • Post: 6532
  • Sesso: Maschio
  • NO MP TECNICI, verranno ignorati
    • Mostra profilo
Re: quanti calcoli può fare un form?
« Risposta #1 il: 13 Apr 2007, 18:02:46 »
E' tutto fatto in Javascript.
Verifica come viene fatta la somma.
Potrebbe essere che sia presente un array sottodimensionato.


AllOne.it Consulting: http://www.allone.it Gens Joomla, il : http://www.gensjoomla.org  [url=http://www.allone.it/jooml

Offline nglca

  • Nuovo arrivato
  • *
  • Post: 32
    • Mostra profilo
Re: quanti calcoli può fare un form?
« Risposta #2 il: 14 Apr 2007, 09:55:16 »
grazie napo,
allora il codice inserito è questo:

function ff_pss_coperta_lana_sub_regular_validat ion(element, message)
{
    ff_pss_calculate();
    if (element.value==0) {
        ff_validationFocus('pss_quantita1_regular');
        return message;
    } // if
    return '';
} // ff_pss_quantita1_validation

function ff_pss_calculate()
{
    var amount = 0;
    var order;

    order = ff_getElementByName('pss_quantita1_regular').value;
    if (order != '') amount += parseInt(order) * 3.00;
   
    order = ff_getElementByName('pss_quantita2_regular').value;
    if (order != '') amount += parseInt(order) * 6.00;
 
    order = ff_getElementByName('pss_quantita3_regular').value;
    if (order != '') amount += parseInt(order) * 2.50;

    order = ff_getElementByName('pss_quantita4_regular').value;
    if (order != '') amount += parseInt(order) * 5.00;
   
    order = ff_getElementByName('pss_quantita5_regular').value;
    if (order != '') amount += parseInt(order) * 2,00;
   
    order = ff_getElementByName('pss_quantita6_regular').value;
    if (order != '') amount += parseInt(order) * 4,00;
   
    order = ff_getElementByName('pss_quantita7_regular').value;
    if (order != '') amount += parseInt(order) * 0.50;

    order = ff_getElementByName('pss_quantita8_regular').value;
    if (order != '') amount += parseInt(order) * 0.30;
   
    order = ff_getElementByName('pss_quantita9_regular').value;
    if (order != '') amount += parseInt(order) * 0.80;

    order = ff_getElementByName('pss_quantita10_regular').value;
    if (order != '') amount += parseInt(order) * 1.00;

    order = ff_getElementByName('pss_quantita11_regular').value;
    if (order != '') amount += parseInt(order) * 2.00;

    order = ff_getElementByName('pss_quantita12_regular').value;
    if (order != '') amount += parseInt(order) * 10.00;

    order = ff_getElementByName('pss_quantita13_regular').value;
    if (order != '') amount += parseInt(order) * 18.00;

ff_getElementByName('pss_coperta_lana_sub_regular').value = Math.round(amount*100)/100;
} // ff_pss_calculate

quando inserisco il codice :
    order = ff_getElementByName('pss_quantita14_regular').value;
    if (order != '') amount += parseInt(order) * 15.00;
non mi esegue più i calcoli di tutte le altre voci.
cosa posso fare?

Offline napo

  • Instancabile
  • ******
  • Post: 6532
  • Sesso: Maschio
  • NO MP TECNICI, verranno ignorati
    • Mostra profilo
Re: quanti calcoli può fare un form?
« Risposta #3 il: 14 Apr 2007, 12:00:24 »
Non saprei, questo codice è corretto.
Ma non è il solo.
C'è un'altra marea di codice JavaScript nella pagina.


AllOne.it Consulting: http://www.allone.it Gens Joomla, il : http://www.gensjoomla.org  [url=http://www.allone.it/jooml

 



Web Design Bolzano Kreatif