Visualizzazione dei risultati da 1 a 3 su 3

Discussione: 00 mi risulta nullo ?

  1. #1
    Utente di HTML.it
    Registrato dal
    Nov 2001
    Messaggi
    184

    00 mi risulta nullo ?

    Ho uno script che valorizza un form così :

    function form_val(theForm, Campi)
    {
    myString = Campi;
    ArrPar = myString.split(',');
    for (i = 0; i < ArrPar.length; i++)
    {
    cmp = Trim(ArrPar[i]);
    if (isNav){
    Val = e.document.forms[theForm].elements[cmp].value;
    } else {
    Val = window.document.forms[theForm].elements[cmp].value;
    }

    if (Val == \"\")
    {
    alert ('Form non completo!');
    if (isNav){
    e.document.forms[theForm].elements[cmp].focus();
    } else {
    window.document.forms[theForm].elements[cmp].focus();
    }

    return false;
    }
    }

    document.forms[theForm].submit();
    return (true);
    }

    Quando un campo è 00 mi da errore di debug :
    'window.document.forms[...].elements[...].value' è nullo o non è un oggetto.
    Come posso fare per evitare questo, che cmq non blocca l'esecuzione dello script però è antipatico ?

    Grazie e a presto.

  2. #2
    Utente di HTML.it
    Registrato dal
    Nov 2001
    Messaggi
    184

    Ops.... correggo!!!

    No forse non è 00 il problema però l'errore è lo stesso.

    Questo tutto lo script php che viene generato :

    <HEAD>
    <TITLE></TITLE>

    <SCRIPT LANGUAGE = "JavaScript">


    function ChkData (Frm, CmpGG, CmpMM, CmpAA, GG, MM, AA, GGConf, MMConf, AAConf)
    {
    if (AA.length == 4)
    {
    if (MM.length != 2){ MM = "0"+MM;}
    if (GG.length != 2){ GG = "0"+GG;}
    DataRit = AA+MM+GG;
    DataOgg = AAConf+MMConf+GGConf;

    if (DataOgg > DataRit)
    {
    alert ('Data Errata');
    document.forms[Frm].elements[CmpGG].value = GGConf;
    document.forms[Frm].elements[CmpMM].value = MMConf;
    document.forms[Frm].elements[CmpAA].value = AAConf;
    document.forms[Frm].elements[CmpGG].focus();
    }
    }
    else
    {
    if (AAData.length == 0)
    {
    document.forms[Frm].elements[CmpGG].value = GGConf;
    document.forms[Frm].elements[CmpMM].value = MMConf;
    document.forms[Frm].elements[CmpAA].value = AAConf;
    }
    else
    {
    alert ('Data Errata');
    document.forms[Frm].elements[CmpGG].value = GGConf;
    document.forms[Frm].elements[CmpMM].value = MMConf;
    document.forms[Frm].elements[CmpAA].value = AAConf;
    document.forms[Frm].elements[CmpGG].focus();
    }
    }
    }

    function CheckAll(formname,checkid,thestate)
    {
    var el_collection=eval("document.forms."+formname+"."+ checkid)
    for (c=0;c<el_collection.length;c++)
    {
    el_collection[c].checked=thestate
    }
    }

    function CopiaCampo (Da, A, Frm)
    {
    if (isNav){
    e.document.forms[Frm].elements[A].value=e.document.forms[Frm].elements[Da].value;
    e.document.forms[Frm].elements[A].focus();
    } else {
    window.document.forms[Frm].elements[A].value=window.document.forms[Frm].elements[Da].value;
    window.document.forms[Frm].elements[A].focus();
    }

    }

    function Cnt(Val, theForm, cmp, Valmax)
    {
    if (Val > Valmax)
    {
    alert ('Valore Errato!');
    if (isNav){
    e.document.forms[theForm].elements[cmp].value='';
    e.document.forms[theForm].elements[cmp].focus();
    } else {
    window.document.forms[theForm].elements[cmp].value='';
    window.document.forms[theForm].elements[cmp].focus();
    }
    }
    }

    function onlynum(e, h)
    {
    if (h == 0){ Min = 46;}
    else { Min = 47;}
    if (e.which)
    {
    if(e.which!=Min && e.which!=8 && (e.which<48 || e.which>57))
    return false;
    }
    else if(e.keyCode)
    {
    if(e.keyCode!=Min && e.keyCode!=8 && (e.keyCode<48 || e.keyCode>57))
    return false;
    }
    return true;
    }

    function form_val(theForm, Campi)
    {
    myString = Campi;
    ArrPar = myString.split(',');
    for (i = 0; i < ArrPar.length; i++)
    {
    cmp = Trim(ArrPar[i]);
    if (isNav){
    Val = e.document.forms[theForm].elements[cmp].value;
    } else {
    Val = window.document.forms[theForm].elements[cmp].value;
    }

    if (Val == "")
    {
    alert ('Form non completo!');
    if (isNav){
    e.document.forms[theForm].elements[cmp].focus();
    } else {
    window.document.forms[theForm].elements[cmp].focus();
    }

    return false;
    }
    }

    document.forms[theForm].submit();
    return (true);
    }

    function WinPers(url, finestra, w, h)
    {
    w = parseInt(screen.width * w/100);
    h = parseInt(screen.height * h/100);

    lt = ((screen.width - w)/2) - 5;
    tp = ((screen.height - h)/2) - 40;
    popupWin = window.open(url,finestra,'left='+lt+', top='+tp+', scrollbars=yes,titlebar=yes, resizable=yes, width='+w+',height = '+h)
    }

    function Trim(stringa)
    {
    reTrim=/\s+$|^\s+/g;
    return stringa.replace(reTrim,"");
    }



    </SCRIPT><SCRIPT LANGUAGE="Javascript">
    function DiffOre(OreDa, MinDa, OreAa, MinAa)
    {
    if ((OreAa != "") && (MinAa !=""))
    {
    if (OreAa < OreDa)
    {
    alert ('Orario errato');
    document.Pian_Int.OreAa.value = '';
    document.Pian_Int.MinAa.value = '';
    }
    else if (OreAa == OreDa)
    {
    if (MinAa < MinDa)
    alert ('Orario errato');
    document.Pian_Int.OreAa.value = '';
    document.Pian_Int.MinAa.value = '';
    }

    }
    }

    function VerificaData (GGData, MMData, AAData, FlgForz, GGOggi, MMOggi, AAOggi)
    {
    if (AAData.length == 4)
    {
    if (MMData.length != 2){ MMData = "0"+MMData;}
    if (GGData.length != 2){ GGData = "0"+GGData;}
    DataPre = AAData+MMData+GGData;
    DataOgg = AAOggi+MMOggi+GGOggi;

    if (DataOgg > DataPre)
    {
    if (FlgForz == true)
    {
    Diff = AAOggi - AAData;
    if (Diff > 1)
    {
    alert ('Impossibile forzare data superiore a 1 anno');
    document.Pian_Int.GGDatPre.value = GGOggi;
    document.Pian_Int.MMDatPre.value = MMOggi;
    document.Pian_Int.AADatPre.value = AAOggi;
    document.Pian_Int.GGDatPre.focus();
    }
    }
    else
    {
    alert ('Data Errata');
    document.Pian_Int.GGDatPre.value = GGOggi;
    document.Pian_Int.MMDatPre.value = MMOggi;
    document.Pian_Int.AADatPre.value = AAOggi;
    document.Pian_Int.GGDatPre.focus();
    }
    }
    }
    else
    {
    if (AAData.length == 0)
    {
    document.Pian_Int.GGDatPre.value = GGOggi;
    document.Pian_Int.MMDatPre.value = MMOggi;
    document.Pian_Int.AADatPre.value = AAOggi;
    }
    else
    {
    alert ('Data Errata');
    document.Pian_Int.GGDatPre.value = GGOggi;
    document.Pian_Int.MMDatPre.value = MMOggi;
    document.Pian_Int.AADatPre.value = AAOggi;
    document.Pian_Int.GGDatPre.focus();
    }
    }
    }
    </SCRIPT>

    </HEAD><BODY bgcolor = "#DEDEDE" TEXT = "#000000"
    vlink = "#000000" alink = "#000000" link = "#000000"
    background="http://www.kekko.int/img/sf1.png" bgproperties="fixed" ><form action="reg_pian.php" method="post" NAME="Pian_Int"
    OnSubmit="return form_val('Pian_Int', 'OreDa, MMDa, OreAa, MmAa, GGDatPre, MMDatPre, AADatPre, CodOpe')">
    <table width="75%" align="left">
    <tr>
    <th align="left" colspan="2">
    - </th>
    </tr>
    <tr>
    <td align="right">
    - </td>
    <td>
    - </td>
    </tr>
    <tr>
    <td colspan="2">
    <input type="CheckBox" NAME="VarDes" VALUE="S"> </td>
    </tr>
    <tr>
    <th class="Menu" colspan="2">
    <nobr>francesco.sguera in data 08/05/2006 alle ore 13:04 ha segnalato :</nobr>
    </th>
    </tr>
    <tr>
    <td align="right">
    Oggetto :
    </td>
    <td>
    <INPUT TYPE="Text" NAME="Oggetto" SIZE="50" Value="NRA : 596">
    </td>
    </tr>
    <tr>
    <td colspan="2" align="center">
    <TEXTAREA NAME="Testo" COLS="100" ROWS="5" WRAP="Physical">Ha lasciato in ufficio per riparazione : Firewall .</TEXTAREA>
    </td>
    </tr>
    <tr>
    <th class="Menu" colspan="2">
    <nobr>Il cliente avrebbe richiesto l'intervento il intorno alle ore </nobr>
    </th>
    </tr>

  3. #3
    Utente di HTML.it
    Registrato dal
    Nov 2001
    Messaggi
    184

    seconda parte script... non entravano più di 13000....

    <tr>
    <td valign="center" align="right">Prenotazione Macchina :</td>
    <td valign="center">
    <INPUT TYPE="CheckBox" NAME="PrnAuto" VALUE="S" >
    Dalle ore : <INPUT TYPE="Text" NAME="OreDa" MAXLENGTH="2" SIZE="2" VALUE="09" onkeypress="return onlynum(event,1)" OnBlur="Cnt(this.value, 'Pian_Int', this.name, 23)">
    <INPUT TYPE="Text" NAME="MinDa" MAXLENGTH="2" SIZE="2" VALUE="00" onkeypress="return onlynum(event,1)" OnBlur="Cnt(this.value, 'Pian_Int', this.name, 59)">

    Alle ore : <INPUT TYPE="Text" NAME="OreAa" MAXLENGTH="2" SIZE="2" VALUE="18" onkeypress="return onlynum(event,1)" OnBlur="Cnt(this.value, 'Pian_Int', this.name, 23)">
    <INPUT TYPE="Text" NAME="MinAa" MAXLENGTH="2" SIZE="2" VALUE="00" onkeypress="return onlynum(event,1)" OnBlur="Cnt(this.value, 'Pian_Int', this.name, 59); DiffOre(OreDa.value, MinDa.Value, OreAa.value, MinAa.value)">
    </td>
    </tr>
    <tr>
    <td align="right">Intervento pianificato il :</td>
    <td>
    <INPUT TYPE="Text" NAME="GGDatPre" MAXLENGTH="2" SIZE="2" VALUE="20" onkeypress="return onlynum(event,1)" OnBlur="Cnt(this.value, 'Pian_Int', this.name, 31)">
    <INPUT TYPE="Text" NAME="MMDatPre" MAXLENGTH="2" SIZE="2" VALUE="11" onkeypress="return onlynum(event,1)" OnBlur="Cnt(this.value, 'Pian_Int', this.name, 12)">
    <INPUT TYPE="Text" NAME="AADatPre" MAXLENGTH="4" SIZE="4" VALUE="2006" onkeypress="return onlynum(event,1)"
    OnBlur ="Cnt(this.value, 'Pian_Int', this.name, 2007);
    VerificaData (GGDatPre.value, MMDatPre.value, AADatPre.value, ForzaData.checked, '20','11','2006')">

    <Input Type="CheckBox" NAME="ForzaData" VALUE="S" OnClick ="VerificaData (GGDatPre.value, MMDatPre.value, AADatPre.value, ForzaData.checked, '20','11','2006')"> Forzatura Data

    <Input Type="CheckBox" NAME="FlgSede" VALUE="C" checked> c/o Sede Cliente

    </td>
    </tr>
    <tr>
    <td align="right">A cura di :</td>
    <td><SELECT NAME ="CodOpe" SIZE="1" COLS="4" OnFocus ="VerificaData (GGDatPre.value, MMDatPre.value, AADatPre.value, ForzaData.checked, '20','11','2006')">
    <OPTION VALUE="00000"></OPTION>
    <OPTION VALUE="00001">ADMIN</OPTION>
    <OPTION VALUE="00002">francesco.sguera</OPTION>
    </SELECT>
    Priorità :
    <SELECT SIZE="1" NAME="Priorita">
    <OPTION VALUE="B">Bassa</OPTION>
    <OPTION VALUE="M">Media</OPTION>
    <OPTION VALUE="A">Alta</OPTION>
    </SELECT>
    </td>

    </tr>
    <tr>
    <td align="right">L'intervento è :</td>
    <td>
    <INPUT TYPE="Radio" NAME="StatoInt" VALUE="N" checked>Pianificato
    <INPUT TYPE="Radio" NAME="StatoInt" VALUE="A" >Annullato
    <INPUT TYPE="Radio" NAME="StatoInt" VALUE="R" >Risolto
    </td>
    </tr>
    <tr>
    <td align="right">
    Avviso :
    </td>
    <td>
    <INPUT TYPE="CheckBox" NAME="FlgAvviso" VALUE="S" >
    </td>
    </tr>

    <tr>
    <th colspan="2">
    <INPUT TYPE="Hidden" NAME="IDInt" VAlUE="0000016722">
    <INPUT TYPE="Hidden" NAME="CodTit" VAlUE="0013">
    <INPUT TYPE="Hidden" NAME="CodSot" VAlUE="0002">
    <INPUT TYPE="Hidden" NAME="DataDa" VALUE="">
    <INPUT TYPE="Hidden" NAME="DataAa" VALUE="">
    <INPUT TYPE="Hidden" NAME="CodGru" VALUE="INITWEB">
    <INPUT TYPE="Hidden" NAME="Citta" VALUE="">
    <INPUT TYPE="Hidden" NAME="RagSoc" VALUE="">
    <INPUT TYPE="Hidden" NAME="RicOpe" VALUE="">
    <INPUT TYPE="Hidden" NAME="PrioritaP" VALUE="">
    <INPUT TYPE="Hidden" NAME="StatoIntP" VALUE="">
    <INPUT TYPE="Hidden" NAME="AnnulInt" VALUE="">
    <INPUT TYPE="Submit" Name ="Comando" VALUE="Registra">
    </th>
    </tr>
    </table>
    </form>

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.