Visualizzazione dei risultati da 1 a 3 su 3

Discussione: post form

  1. #1

    post form

    vado subito al sodo, ho uno javascript che recupera i dati da un form generato da php ( qui di seguito il codice) ma non riesco a POSTARLO ! sto diventando matto , non capisco come mai il parsin dei dati non avvenga.

    il codice javascript è riciclato dato che il mio non funzava ho pensato fossero dei problemi sui cicli di retrieve dei campi dal form ( funzione getAnteprima() ) ma pare proprio di no

    un aiutino a togliermi il prosciutto dagli occhi


    javascript
    codice:
    <script type="text/javascript" language="javascript">
       var http_request = false;
       function makeRequestAnteprima(url, parameters) {
          http_request = false;
          if (window.XMLHttpRequest) { // Mozilla, Safari,...
             http_request = new XMLHttpRequest();
             if (http_request.overrideMimeType) {
             	// set type accordingly to anticipated content type
                http_request.overrideMimeType('text/xml');
                http_request.overrideMimeType('text/html');
             }
          } else if (window.ActiveXObject) { // IE
             try {
                http_request = new ActiveXObject("Msxml2.XMLHTTP");
             } catch (e) {
                try {
                   http_request = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
             }
          }
          if (!http_request) {
             alert('Cannot create XMLHTTP instance');
             return false;
          }
          http_request.onreadystatechange = alertContentsAnteprima;
          http_request.open('GET', url + parameters, true);
          http_request.send(null);
       }
    
       function alertContentsAnteprima() {
          if (http_request.readyState == 4) {
             if (http_request.status == 200) {
                alert(http_request.responseText);
                result = http_request.responseText;
                document.getElementById('myspan').innerHTML = result;            
             } else {
                alert('There was a problem with the request.');
             }
          }
       }
       
       function getAnteprima(obj) {
          var getstr = "?";
          for (i=0; i<obj.childNodes.length; i++) {
             if (obj.childNodes[i].tagName == "INPUT") {
             	alert('input');         	
                if (obj.childNodes[i].type == "text") {
                   getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&";
                }
                if (obj.childNodes[i].type == "checkbox") {
                   if (obj.childNodes[i].checked) {
                      getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&";
                   } else {
                      getstr += obj.childNodes[i].name + "=&";
                   }
                }
                if (obj.childNodes[i].type == "radio") {
                   if (obj.childNodes[i].checked) {
                      getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&";
                   }
                }
             }   
             if (obj.childNodes[i].tagName == "SELECT") {
                var sel = obj.childNodes[i];
                getstr += sel.name + "=" + sel.options[sel.selectedIndex].value + "&";
             }
             
          }
          makeRequestAnteprima('azioni/anteprima.php', getstr);
       }
    </script>
    form
    codice:
    <form action="javascript:getAnteprima(document.getElementById('anteprima'));" name="anteprima" id="anteprima">
    
    	<table border="0" width="100%">
    	<tbody><tr>
    		<td>
    		<table border="1"><tbody><tr><td rowspan="2" valign="top">Quantita ordine:</td>
    <td align="right" width="50">0</td>
    <td>Pezzi.</td></tr>
    
    </tbody></table>
    		</td>
    		<td>
    		<table border="1">
    	<tbody><tr>
    <td>COLORE</td>
    <td>AZZU</td>
    <td>GIAL</td>
    <td>NATU</td>
    
    <td>BLU1</td>
    <td>ROYA</td>
    <td>BIAN</td>
    <td>SENA</td>
    </tr>
    	<tr>
    <td>50X80</td>
    <td><input class="CampoPink" name="a200000303032AZ" value="" maxlength="3" type="text"></td>
    <td><input class="CampoPink" name="a200000303032GI" value="" maxlength="3" type="text"></td>
    <td><input class="CampoPink" name="a200000303032NA" value="" maxlength="3" type="text"></td>
    <td><input class="CampoPink" name="a200000303032B1" value="" maxlength="3" type="text"></td>
    
    <td><input class="CampoPink" name="a200000303032RY" value="" maxlength="3" type="text"></td>
    <td><input class="CampoPink" name="a200000303032BI" value="" maxlength="3" type="text"></td>
    <td><input class="CampoPink" name="a200000303032SE" value="" maxlength="3" type="text"></td>
    </tr>
    </tbody></table>		</td>
    	</tr>
    	<tr>
    		<td colspan="2" align="center" bgcolor="grey">
    			<input name="button" value="Normal Submit Button" type="submit">
    			<input name="button" value="Submit" onclick="javascript:getAnteprima(this.parentNode);" type="button">
    		</td>
    
    	</tr>
    	</tbody></table>
    	</form>
    Graaaazie
    - Ander Costruscion -

  2. #2
    risolto ,a ma senza una soluzione , CHE STO ANCORA CERCANDO , cioè ho tolto la tabella e pare funzare, adesso devo diventare un attimino matto con le css per ordinare i campi .. ce par di balis!

    mandi e grazie comunque
    - Ander Costruscion -

  3. #3
    :quote:

    non riesco a capire come mai non mi fa il post se ho i dati di input nella table! .. sto impazzendo!

    peppiacere .. aiuttoooo :|
    - Ander Costruscion -

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.