Avatar billede okf2000 Novice
27. januar 2014 - 09:38 Der er 1 kommentar

Kan ikke få min disable til at virke på dropdown box. men godt test input

Hej.

Her er forsøgt lidt af hvert, men jeg kan bage ikke få disable af opret til at virke på dropdown´en
men fjerne jeg den del med dropdown boxen virke den fint.

kan i hjælpe mig med at finde fejlen.
----------------------------------------------------------------

JAVA SCHIPT KODE
----------------------------------------------------------------

function formValidation(oEvent) {
oEvent = oEvent || window.event;
var txtField = oEvent.target || oEvent.srcElement;

var t1ck=true;
var msg=" ";
if(document.getElementById("t1").value.length < 3 ){ t1ck=false; msg = msg + " Firma min. 3 karater";}
if(document.getElementById("t2").value.length < 1 ){ t1ck=false; msg = msg + " Select one of the games ";}
if(document.getElementById("t3").value.length < 2 ){ t1ck=false; msg = msg + " Select one of the games ";}
if(document.getElementById("t4").value.length < 1 ){ t1ck=false; msg = msg + " Select one of the games ";}
if(document.getElementById("t5").value.length < 1 ){ t1ck=false; msg = msg + " Select one of the games ";}
if(document.getElementById("t6").value.length < 1 ){ t1ck=false; msg = msg + " Select one of the games ";}
if(document.getElementById("t7").value.length < 1 ){ t1ck=false; msg = msg + " Select one of the games ";}
if(document.getElementById("t8").value.length < 1 ){ t1ck=false; msg = msg + " Select one of the games ";}
if(document.getElementById("t9").value.length < 1 ){ t1ck=false; msg = msg + " Select one of the games ";}
if(document.getElementById("t10").value.length < 1 ){ t1ck=false; msg = msg + " Select one of the games ";}
if(document.getElementById("t11").value.length < 1 ){ t1ck=false; msg = msg + " Select one of the games ";}
if(document.getElementById("t12").value.length < 1 ){ t1ck=false; msg = msg + " Select one of the games ";}
if(document.getElementById("t13").value.length < 1 ){ t1ck=false; msg = msg + " Select one of the games ";}
if(document.getElementById("t14").value.length < 1 ){ t1ck=false; msg = msg + " Select one of the games ";}
if(document.getElementById("ind_kode").value.length = 1 ){ t1ck=false; msg = msg + " Select one of the games ";}

//alert(msg + t1ck);

if(t1ck){document.getElementById("opret").disabled = false; }
else{document.getElementById("opret").disabled = true; }
}

window.onload = function () {

var opret = document.getElementById("opret");

var t1 = document.getElementById("t1");
var t2 = document.getElementById("t2");
var t3 = document.getElementById("t3");
var t4 = document.getElementById("t4");
var t5 = document.getElementById("t5");
var t6 = document.getElementById("t6");
var t7 = document.getElementById("t7");
var t8 = document.getElementById("t8");
var t9 = document.getElementById("t9");
var t10 = document.getElementById("t10");
var t11 = document.getElementById("t11");
var t12 = document.getElementById("t12");
var t13 = document.getElementById("t13");
var t14 = document.getElementById("t14");
var ind_kode = document.getElementById("ind_kode");



var t1ck=false;
document.getElementById("opret").disabled = true;
t1.onkeyup = formValidation;
t2.onkeyup = formValidation;
t3.onkeyup = formValidation;
t4.onkeyup = formValidation;
t5.onkeyup = formValidation;
t6.onkeyup = formValidation;
t7.onkeyup = formValidation;
t8.onkeyup = formValidation;
t9.onkeyup = formValidation;
t10.onkeyup = formValidation;
t11.onkeyup = formValidation;
t12.onkeyup = formValidation;
t13.onkeyup = formValidation;
t14.onkeyup = formValidation;
ind_kode.onkeyup = formValidation; 
}

--------------------------------------------------------------

PHP/HTML KODE
--------------------------------------------------------------

<?php     if(!isset($_POST['multi'])) {
    if(!isset($_POST['kopi'])) {
    if(!isset($_POST['send_multi'])) { ?>
  <div class="h1">Pro Consult A/S - PROservice - Indskiving</div>
  <form method="post" action="" onsubmit="return v(this)">
  <div class="con" id="container" style="width:100%; height:54px; background-color:#dddddd; padding:0;">
        <div class="rubrik1">
            <div class="rubrik9">Firmanavn:</div>
            <div class="rubrik9" style="border-top:2px solid black;"><input style="text-transform:uppercase;" class="in1" type="text" name="firma_navn" value="" onblur="ajaxFunction()" id='t1'></div>
        </div>
        <div id="container2" style="height:100%; width:25%; background-color:#FF5555; float:left; padding:0;">
            <div class="rubrik3">Udfyld kun ved rød rapport ellers efter lad tom</div><br style="clear:both;">
            <div class="rubrik4" style="border-right:0px; border-left:0px; padding:0;">Ans. for rep.:</div>
            <div class="rubrik4"><select id="s1" class="select" name="ans">
                  <option value="50">50 Uden Ansvar Lejre</option>
                  <option value="51">51 Uden Ansvar Vejle</option>
                          <?php $result = mysql_query("SELECT * FROM promed WHERE lukket != 'JA' ORDER BY id ASC");
                                while($row = mysql_fetch_assoc($result)) {
                        $ans = $row['id'];?>
                  <option value="<?php echo ''.$row['id'].''; ?>"><?php echo ''.$row['id'].''; ?>
                  <?php $result2 = mysql_query("SELECT * FROM promed WHERE id=$ans");
                                while($row2 = mysql_fetch_assoc($result2)) {
                                echo ''.$row['navn'].''; ?>
                  </option> <?php } }?></Select>
            </div>
        </div>
        <div id="rapport" class="rubrik2"><input class="in_rapp" type="text" name="id_ind" value="">
        </div><br style="clear:both;" >
  </div>
<p id="hoved">
  <div class="con" id="container3" style="width:100%; background-color:#ffffff; border:2px solid black; ">
<! -------------------------------------------------- Line 1 i hoved --------------------------------------------------------------------------------------------------------- !>
        <div class="rubrik5" style="border-right:2px solid black;">
            <div class="t_rubrik_5" style="border-right:2px solid black;">C/O firmanavn: </div>
            <div id='ajaxDiv' class="i_rubrik_5"><input class="in_5" id="t2" type="text" name="navn" value=""></div>
        </div>
        <div class="rubrik6" style="border-right:2px solid black;">
            <div class="t_rubrik_6" style="border-right:2px solid black;">Dine int:</div>
            <div class="i_rubrik_6"><input class="in_6" id="t3" type="text" name="v_ref" value=""></div>
        </div>
        <div class="rubrik6">
            <div class="t_rubrik_6" style="border-right:2px solid black;">Dato:</div>
            <div class="i_rubrik_6"><input class="in_6" type="text" name="dato" value="<?php echo date('j-m-Y'); ?>" style="background-color:#cccccc; color:red ;"></div>
        </div><br style="clear:both;" >
<! -------------------------------------------------- Line 2 i hoved --------------------------------------------------------------------------------------------------------- !>
        <div class="rubrik5" style="border-right:2px solid black;">
            <div class="t_rubrik_5" style="border-right:2px solid black;">Adresse:  </div>
            <div id='t4_r' class="i_rubrik_5"><input class="in_5" id="t4" type="text" name="adresse" value=""></div>
        </div>
        <div class="rubrik5">
            <div class="t_rubrik_5" style="border-right:2px solid black;">Kundes Ref.: </div>
            <div class="i_rubrik_5"><input class="in_5" id="t5" type="text" name="d_ref" value=""></div>
        </div><br style="clear:both;" >
<! -------------------------------------------------- Line 3 i hoved --------------------------------------------------------------------------------------------------------- !>
        <div class="rubrik5" style="border-right:2px solid black;">
            <div class="t_rubrik_5" style="border-right:2px solid black;">Post nr.: </div>
            <div id='t6_r' class="i_rubrik_5"><input class="in_5" id="t6" type="text" name="post" value=""></div>
        </div>
        <div class="rubrik5">
            <div class="t_rubrik_5" style="border-right:2px solid black;">Rekv. nr.:</div>
            <div class="i_rubrik_5"><input class="in_5" id="t7" type="text" name="revk" value=""></div>
        </div><br style="clear:both;" >
<! -------------------------------------------------- Line 4 i hoved --------------------------------------------------------------------------------------------------------- !>
        <div class="rubrik5" style="border-right:2px solid black;">
            <div class="t_rubrik_5" style="border-right:2px solid black;">By: </div>
            <div id='t8_r' class="i_rubrik_5"><input class="in_5" id="t8" type="text" name="by" value=""></div>
        </div>
        <div class="rubrik6" style="border-right:2px solid black;">
            <div class="t_rubrik_6" style="border-right:2px solid black;">Telefon nr.:</div>
            <div id='t9_r' class="i_rubrik_6"><input class="in_6" id="t9" type="text" name="telefon" value=""></div>
        </div>
        <div class="rubrik6">
            <div class="t_rubrik_6" style="border-right:2px solid black;">evt. mobil nr.:</div>
            <div class="i_rubrik_6"><input class="in_6" id="t10" type="text" name="mobil" value=""></div>
        </div><br style="clear:both;" >
<! -------------------------------------------------- Line 5 i hoved --------------------------------------------------------------------------------------------------------- !>
        <div class="rubrik6" style="border-right:2px solid black;">Fabrikat:</div> 
        <div class="rubrik6" style="border-right:2px solid black;">Type:</div>
        <div class="rubrik6" style="border-right:2px solid black;">Maskine:</div>
        <div class="rubrik6">serie Nr.:</div><br style="clear:both;" >
<! -------------------------------------------------- Line 6 i hoved --------------------------------------------------------------------------------------------------------- !>
        <div class="rubrik6" style="border-right:2px solid black;"><input class="in_6_spe" id="t11" type="text" name="fabrikat" value=""></div> 
        <div class="rubrik6" style="border-right:2px solid black;"><input class="in_6_spe" id="t12" type="text" name="type" value=""></div>
        <div class="rubrik6" style="border-right:2px solid black;"><input class="in_6_spe" id="t13" type="text" name="maskine" value=""></div>
        <div class="rubrik6"><input class="in_6_spe" id="t14" type="text" name="sn_nr" value=""></div><br style="clear:both;" >
<! -------------------------------------------------- Line 5 i hoved --------------------------------------------------------------------------------------------------------- !>
        <div class="rubrik6" style="border-right:2px solid black;">Levendør (Kun salg) (gr. 7):</div> 
        <div class="rubrik6" style="border-right:2px solid black;">Type/vare nr. (Kun salg) (gr. 7):</div>
        <div class="rubrik6" style="border-right:2px solid black;">Kontagt person (Kun salg) (gr. 7):</div>
        <div class="rubrik6"></div><br style="clear:both;" >
<! -------------------------------------------------- Line 6 i hoved --------------------------------------------------------------------------------------------------------- !>
        <div class="rubrik6" style="border-right:2px solid black;"><input class="in_6_spe" id="t16" type="text" name="salg_lev" value=""></div> 
        <div class="rubrik6" style="border-right:2px solid black;"><input class="in_6_spe" id="t17" type="text" name="salg_type" value=""></div>
        <div class="rubrik6" style="border-right:2px solid black;"><input class="in_6_spe" id="t18" type="text" name="salg_kontagt" value=""></div>
        <div class="rubrik6"></div><br style="clear:both;" >
<! -------------------------------------------------- Line 7 i hoved --------------------------------------------------------------------------------------------------------- !>
        <div class="rubrik7" style="background-color:#eeeeee;">Beskivelse af anmeldt fejl</div><br style="clear:both;" >
<! -------------------------------------------------- Line 8 i hoved --------------------------------------------------------------------------------------------------------- !>
        <div class="rubrik7" style="height:54px;"><textarea class="baaf" id="t15" name="baaf" rows="2" cols="20"></textarea></div><br style="clear:both;" >
<! -------------------------------------------------- Line 9 i hoved --------------------------------------------------------------------------------------------------------- !>
        <div class="rubrik7" style="background-color:#eeeeee;">Note:</div><br style="clear:both;" >
<! -------------------------------------------------- Line 9 i hoved --------------------------------------------------------------------------------------------------------- !>
        <div class="rubrik7"><textarea class="note" name="note"  rows="2" cols="20"></textarea></div><br style="clear:both;" >
<! -------------------------------------------------- Line 10 i hoved -------------------------------------------------------------------------------------------------------- !>
        <div class="rubrik6" style="border-right:2px solid black;">
            <div class="t_rubrik_6" style="border-right:2px solid black;">Pris skønnet: </div>
            <div class="i_rubrik_6"><input class="in_6" type="text" name="pris_s" value=""></div>
        </div> 
        <div class="rubrik6" style="border-right:2px solid black;">
            <div class="t_rubrik_6" style="border-right:2px solid black;">Pris Ny:</div>
            <div class="i_rubrik_6"><input class="in_6" type="text" name="pris_b" value=""></div>
        </div>
        <div class="rubrik6" style="border-right:2px solid black;">
            <div class="t_rubrik_6" style="border-right:2px solid black;">Pris brugt/ebay:</div>
            <div class="i_rubrik_6"><input class="in_6" type="text" name="pris_n" value=""></div>
      </div>
        <div class="rubrik6">
            <div class="t_rubrik_6" style="border-right:2px solid black;">Pris kundeaftale: </div>
            <div class="i_rubrik_6"><input class="in_6" type="text" name="pris_k" value=""></div>
        </div><br style="clear:both;" >
<! -------------------------------------------------- Line 11 i hoved -------------------------------------------------------------------------------------------------------- !>
        <div class="rubrik6" style="border-bottom:0px solid black; border-right:2px solid black;">
            <div class="t_rubrik_6" style="border-right:2px solid black;">Medf. Emb.:</div>
            <div class="i_rubrik_6"><select class="select_6" name="med_emb">
                                            <option>?</option>
                                            <option>JA</option>
                                            <option>NEJ</option>
                                    </select></div> 
        </div>
        <div class="rubrik6" style="border-bottom:0px solid black; border-right:2px solid black;">
            <div class="t_rubrik_6" style="border-right:2px solid black;">Dok. Retur:</div>
            <div class="i_rubrik_6"><select class="select_6" name="dok_retur">
                                                            <option>?</option>
                                                            <option>JA</option>
                                                            <option>NEJ</option>
                                    </select></div>
        </div>
        <div class="rubrik6" style="border-bottom:0px solid black; border-right:2px solid black;">
            <div class="t_rubrik_6" style="border-right:2px solid black;">Haster den:</div>
            <div class="i_rubrik_6"><select class="select_6" name="asap">
                                            <option>NEJ</option>
                                            <option>JA</option>
                                    </select></div>
        </div>
        <div class="rubrik6" style="border-bottom:0px solid black;">
            <div class="t_rubrik_6" style="border-right:2px solid black;">Indskivings gr.:</div>
            <div class="i_rubrik_6"><select class="select_6" name="ind_kode">
                                            <option value="">Gr. - (Skal valges)</option>
                                            <option value="0">Gr. 0 (Indlevet Sjælland)</option>
                                            <option value="1">Gr. 1 (Indlevet Jylland)</option>
                                            <option value="2">Gr. 2 (Agentur)</option>
                                            <option value="3">Gr. 3 (Udarbj.+ medf. SJ)</option>
                                            <option value="4">Gr. 4 (Udarbj.+ medf. JY)</option>
                                            <option value="5">Gr. 5 (Indlevet Udland)</option>
                                            <option value="6">Gr. 6 (Udarbjeder Udland)</option>
                                            <option value="7">Gr. 7 (Salg)</option>
                                            <option value="8">Gr. 8 (Reglamationer)</option>
                                    </select></div>
      </div><br style="clear:both;" >
  </div>
<p id="knapper">
  <div class="con" id="container4" style="width:100%; background-color:#ffffff;">
        <div class="rubrik8"><input class="bottom_8" id="opret" type="submit" value="opret service rapport" name="send"></div>
        <div class="rubrik8"><input class="bottom_8" type="submit" value="Multi opretter" name="multi"></div></form>
        <form action="listen.php" method="post" onclick="window.open(this.action); return false;"><div class="rubrik8"><input class="bottom_8"  type="submit" value="GÃ¥ til Ordre liste" name="send5"></div></form>
        <br style="clear:both;" >
        <?php
        if(isset($_POST['send'])) {
        if(empty($_POST['id_ind']) OR $_POST['id_ind'] == '-'){
        if($_POST['ind_kode'] == 7) {
          echo '<form action="salgsrapport.php?id='.$id.'" method="post" onclick="window.open(this.action); return false;"><div class="rubrik8"><input class="bottom_8"  type="submit" value="Print salgs rapport '.$id.'" name="send1"></div></form> ' ;
          } else {
          echo '<form action="rapportkort.php?id='.$id.'" method="post" onclick="window.open(this.action); return false;"><div class="rubrik8"><input class="bottom_8"  type="submit" value="Print rapport kort '.$id.'" name="send2"></div></form> ' ;
          }
          echo '<form action="label_pdf.php?id='.$id.'" method="post" onclick="window.open(this.action); return false;"><div class="rubrik8"><input class="bottom_8"  type="submit" value="Print rep. label til: '.$id.'" name="send3"></div></form> ' ;
          echo '<form action="med_label_pdf.php?id='.$id.'" method="post" onclick="window.open(this.action); return false;"><div class="rubrik8"><input class="bottom_8"  type="submit" value="Print medf. label til:'.$id.'" name="send4"></div></form> ' ;
        } }?>
  </div>
<?php } } } ?>

-----------------------------------------------------------------

Jeg ved godt er mine koder er rodet så det behøver jeg ikke at få afvide.

Med Venlig Hilsen
Otto Algreen
Avatar billede okf2000 Novice
27. januar 2014 - 09:41 #1
her prøvet disse uden held

if(document.getElementById("ind_kode").value.length > 1 ){ t1ck=false; msg = msg + " Select one of the games ";}

if(document.getElementById("ind_kode").value.length > 0 ){ t1ck=false; msg = msg + " Select one of the games ";}

if(document.getElementById("ind_kode").value != "-" ){ t1ck=false; msg = msg + " Select one of the games ";}

ind_kode.onkeyclick = formValidation;
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Vi tilbyder markedets bedste kurser inden for webudvikling

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester