awarie formularzy HTML IE 11

Mam następujący kod.

Użytkownik wypełnia i przesyła pierwszy formularz. Gdy trafi „wyślij”, dane są zapisywane w db za pośrednictwem stron internetowych. W tym samym czasie serwer zwraca właśnie utworzony nowy identyfikator. Ten identyfikator jest przechowywany w ukrytej formie. Przycisk wysyłania ukrytego formularza pojawia się po zwróceniu identyfikatora.

Jeśli użytkownicy chcą trafień, przesłanie ukrytego formularza (teraz już niewidocznego) i przeniesienie na inną stronę, gdzie identyfikator jest również przesyłany za pośrednictwem formularza.

W pierwszej formie użytkownik może nacisnąć przycisk i pojawi się więcej pól tekstowych, aby mógł dodać dane. Maksymalna liczba tych pól testowych wynosi 10. W tym celu sam napisałem do JS. Pola dodawane dynamicznie za pośrednictwem JS.

Działa to w Chrome i Firefox. Używany do pracy w IE 10. Ponieważ IE zaktualizowano w IE 11.0.9600.16476:

jeśli wypełnię i prześlę pierwszy formularz, działa.

jeśli wypełnię pierwszy formularz, a następnie kliknę „Wyczyść wszystko”, awarię IE

Jeśli wypełnię / prześlę formularz ifirst, a następnie prześlę drugi formularz, awarię IE

Używam Windows 7

Jedynym sposobem na to jest skomentowanie tych linii

document.getElementById("source").value="";
document.getElementById("contr").value="";

Zrobiłem wszystko, co w mojej mocy i wiedzy. Ponownie edytuj, użyj JS do przesłania, edytujenctype, użyj adresu URL, aby przekazać dane. W ogóle nic. Nie ma już dla mnie sensu.

Proszę, każda rada zrobi.

Z góry dziękuję. Przepraszam za ogromny post

Oto kod

//globals for links
var gco=1;
var arforl=[];

//save form data and show hidden button of the 2nd form
function save(){
  //edit the data of a field
  var sourceSpace=document.getElementById("source").value; var sourceNoSpace=sourceSpace.replace(/\s/g, '');

  //get all the extra links, put a | betwwen them
  var fst ="|";
  for (var a=0;a < arforl.length; a++){     
     if (document.getElementById(arforl[a]).value!="")
     {fst+=document.getElementById(arforl[a]).value+"|";}
   }

  var ffst = fst.slice(1,fst.length-1);

  var so = new WebSocket("ws://localhost:8000");

  //get all the values from first form and other values, send via websockets
  so.onopen = function(){
   so.send(JSON.stringify({command: 'insertAll',
   name: document.getElementById('name').value,
   geo: hul,
   geoT:'point',
   descr: document.getElementById('descr').value,
   chron: document.getElementById('chron').value,  
   type: document.getElementById('typeselect').value,  
   era: document.getElementById('eraselect').value,  
   lin: document.getElementById('link').value+"|"+ffst,  
   sourc: sourceNoSpace,  
   contr: document.getElementById('contr').value,
   conler:idc

  }));}

  so.onmessage = function (evt) { 
   //get the new id from websockets 
   var received_msg = evt.data;

   //clear the form, show some messages 
   document.getElementById("next").style.display="block";
   document.getElementById("saveB").style.display="block";

   document.getElementById("name").value="";
   document.getElementById("descr").value="";
   document.getElementById("chron").value="";
   document.getElementById("typeselect").value=" ";
   document.getElementById("eraselect").value=" ";
   document.getElementById("link").value="";

     // i have to comment the next lines for this to work
   document.getElementById("source").value="";
   document.getElementById("contr").value="";

   //clear the extra links
   clearLinks();

   //pass the new id in the hidden form
   document.getElementById("pinid").value=received_msg;
   so.close();
   }

}//closes save()


//adds more text fields for links
function moreLink(){
  if (gco!=10){
  var newLinkb=[];

  document.getElementById("extraLink").appendChild(document.createElement("br"));
  newLinkb[gco]= document.createElement('input');
  newLinkb[gco].setAttribute('type','text');
  newLinkb[gco].setAttribute('id',gco);
  newLinkb[gco].setAttribute('onfocus','cleari()');
  document.getElementById("extraLink").appendChild(newLinkb[gco]);
  arforl.push(gco);             
  gco++;
  }

 else
 {document.getElementById("extraLink2").innerHTML="max is 10";}

}

//clears the extra links
function clearLinks(){
 for (var d=0;d < arforl.length; d++){
 document.getElementById(arforl[d]).value="";
    }
}

function clearall(){
          document.getElementById("name").value="";
          document.getElementById("descr").value="";
          document.getElementById("chron").value="";
          document.getElementById("typeselect").value=" ";
          document.getElementById("eraselect").value=" ";
          document.getElementById("link").value="";
     // i have to comment the next lines for this to work
          document.getElementById("source").value="";
          document.getElementById("contr").value="";    
}

HTML:

pierwsza forma:

<form  name="inserterPoint" action="#" method="post" enctype="multipart/form-data">
Name <br>
<input name="name" id="name" class="textformfront" type="text" required  >

Description<br>
<textarea name="descr" id="descr" class="textformfront" rows="24" cols="50" required ></textarea>

Chronology
<input name="chron" id="chron" class="textformfront" type="text" required  >


  Type : <br>
  <select name="typeselect" id="typeselect" >
    <option selected value=" ">Pick one</option>
    <?php
      for ($d=0; $d< sizeof($typos) ; $d++)
           {echo '"<option value="'.$tid[$d].'" typeselect='.$tid[$d].'>'.$typos[$d].'</option>';}
    ?>
  </select>

 Era:<br>
  <select name="eraselect" id="eraselect" >
    <option selected value=" ">Pick one</option>
    <?php 
        for ($g=0; $g< sizeof($era) ; $g++)
             {echo '"<option value="'.$eid[$g].'" eraselect='.$eid[$g].'>'.$era[$g].'</option>';}
       ?>
  </select>

Links<br>
 <input name="link" id = "link" type="text" class="textformfront" required >

  <div id="extraLink"></div>
  <input type="button" onClick="moreLink();" value="More links" class="formButtonMap">

  <div id="extraLink2"></div>

Sources<br>
  <textarea name="source" id= "source" class="textformfront"  rows="24" cols="50" required ></textarea>

Contributors
<textarea name="contr" id="contr" class="textformfront"   rows="24" cols="50" ></textarea>

<input type="button"  id="clearAll" value="Clear All" class="formButtonMap" onClick="clearall();>


<input type="button"  id="saveB" value="Save All" class="formButtonMap" onClick="save();" style="display:none">

druga forma:

  <form name="nextform" action="anotherpage.php" method="post" enctype="multipart/form-data">
    <input name="pinid" id="pinid" type="hidden">
    <input type="submit" value="Go to another page" class="formButtonMap">
  </form>

EDYTOWAĆ

Przez „IE crash” mam na myśli to, że przez jakiś czas nic się nie dzieje. Następnie, jeśli kliknę na dowolną stronę na stronie, dostanę komunikat „Strona nie odpowiada” i tylko jeśli kliknę „Odzyskaj”, przenosi mnie na drugą stronę. Ale nowy identyfikator NIE jest przekazywany na drugiej stronie.

EDYCJA 2 Zastanawiać się dlaczegodescr który jest również polem tekstowym, nie jest również częścią problemu. To znaczy, nie muszę komentować linii, która oczyszcza jej wartość. Więc przeniosłem go na koniec formularza. I okazuje się, że muszę skomentować linię, która oczyszcza jej wartość, aby strona działała.

Następnie przesunąłem część linków na górze formularza. I muszę skomentować linie, które usuwają wartości wszystkiego oprócz linków, aby strona działała. Wygląda na „wzór”. Wszystko poniżej części łączy powoduje problem. Ale jeśli skomentuję linki i JS o linkach, problem nadal istnieje. Nadal nie ma sensu ...

questionAnswers(2)

yourAnswerToTheQuestion