Probelm in 'optionfield'

S

Sol

Yesterday Jim Buyens, many thanks for him, wrote me this scrit to be able to
split my long questionnaire form and transfer the data from each form as
hidden and finnaly to the server.

I am experiencing one pro though: I use the Optionfield on some
questions(where there can only be one answer to that Q from different
options. To make the selection change b/n option. I have to give the SAME
group name to my option fields of ONE Q. However, up one using the script
from JIm, I get all the options, including the anselected ones as a submited
result

What should I do pls

Below is Jim's script and procedure

Thanks


On the first form page, right-click the form and choose Properties. Then,
select Send To Other and click Options.

In the resulting dialog box, set Action to the URL of your second form, and
Method to GET.

Now open the second form and add the following script to the <head> section.

<script>
function qsobj (){
var qvbl;
var qstring = "" + document.location.search.substring(1);
if (qstring != ""){
var qpairs = qstring.split("&");
for (i=0; i < qpairs.length; i++) {
qvbl = qpairs.split("=");
this["" + qvbl[0]] = unescape(qvbl[1].replace("+"," "));
}
}
}
function getqsvar(qsvar){
if (qstr[qsvar] == null){
return "";
}else{
return qstr[qsvar];
}
}
var qstr = new qsobj();

function initForm()
{
document.forms[0].C1.value = getqsvar("C1");
document.forms[0].T1.value = getqsvar("T1");
}
</script>

Note the two statements:
document.forms[0].C1.value = getqsvar("C1");
document.forms[0].T1.value = getqsvar("T1");
You need to modify/duplicate these once for each form field on the first
page. For example, if the first page contains four fields named custname,
address, city, and state, code:
document.forms[0].custname.value = getqsvar("custname");
document.forms[0].address.value = getqsvar("address");
document.forms[0].city.value = getqsvar("city");
document.forms[0].state.value = getqsvar("state");

Next, add an onload= attribute to the <body> tag like this.

<body onload="initForm();">

Finally, for each field on the first Web page, add a hidden form field like
ones below to the form on the second page:

<input type="hidden" name="custname" value="">
<input type="hidden" name="address" value="">
<input type="hidden" name="city" value="">
<input type="hidden" name="state" value="">
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top