synchronized
02-21-2007, 06:59 PM
Hello,
Thanks for taking the time to look at my question.
I use ajax to create a dynamic form:
step 1) form has some <input type=radio> and <input type=checkbox> fields to start with.
step 2) this value is sent via ajax to somefile.php file. That somefile.php file generates a new part of the form (containing <input type=radio>, <input type=checkbox> and <inpu typet=text> fields) > so the user will fill in more variables than he started with.
When I submit this form (<input type=submit>, no javascript involved), only the original form variables are transferred.
I use a basic javascript to transfer data between the form & somefile.php
<script LANGUAGE="javascript" TYPE="text/javascript">
<!--
//Browser Support Code
function showfieldsbyclass(theclass,initiate){
var ajaxRequest;
try{
// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
} catch (e){
// Internet Explorer Browsers
try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
// Something went wrong
alert("Your browser broke!");
return false;
}
}
}
// Create a function that will receive data sent from the server
ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4){
ajaxclass.innerHTML = ajaxRequest.responseText;
}
}
ajaxRequest.open('GET', 're_ajax.php?function=showfieldsbyclass&class='+theclass+'&initiate='+initiate, true);
ajaxRequest.send(null);
}
//-->
</script>
and this is the javascript that I use: onclick=\"javascript:showfieldsbyclass('0','');\"
So the ajax to build my additional form fields works great but the problem is that only the original forms variables/values are sent when I press the submit button.
o jeah.. one more thing: The new form variables/values are transmitted on IE, but not on firefox!
Thanks,
Cedric
Thanks for taking the time to look at my question.
I use ajax to create a dynamic form:
step 1) form has some <input type=radio> and <input type=checkbox> fields to start with.
step 2) this value is sent via ajax to somefile.php file. That somefile.php file generates a new part of the form (containing <input type=radio>, <input type=checkbox> and <inpu typet=text> fields) > so the user will fill in more variables than he started with.
When I submit this form (<input type=submit>, no javascript involved), only the original form variables are transferred.
I use a basic javascript to transfer data between the form & somefile.php
<script LANGUAGE="javascript" TYPE="text/javascript">
<!--
//Browser Support Code
function showfieldsbyclass(theclass,initiate){
var ajaxRequest;
try{
// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
} catch (e){
// Internet Explorer Browsers
try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
// Something went wrong
alert("Your browser broke!");
return false;
}
}
}
// Create a function that will receive data sent from the server
ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4){
ajaxclass.innerHTML = ajaxRequest.responseText;
}
}
ajaxRequest.open('GET', 're_ajax.php?function=showfieldsbyclass&class='+theclass+'&initiate='+initiate, true);
ajaxRequest.send(null);
}
//-->
</script>
and this is the javascript that I use: onclick=\"javascript:showfieldsbyclass('0','');\"
So the ajax to build my additional form fields works great but the problem is that only the original forms variables/values are sent when I press the submit button.
o jeah.. one more thing: The new form variables/values are transmitted on IE, but not on firefox!
Thanks,
Cedric
