PC Review
Forums
Newsgroups
Microsoft Word
Microsoft Frontpage
Problem in transfering 'option' fields as hidden field
Forums
Newsgroups
Microsoft Word
Microsoft Frontpage
Problem in transfering 'option' fields as hidden field
![]() |
Problem in transfering 'option' fields as hidden field |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Hi there!
I have got this script from Jim Buyens to enable me transfer data from one form to another. Thanks Jim I am experienceing one problem, with 'OPTIONFIEDS', in optionfields it transfer the whole options,INCLUDING THE UNSELECTED ONES. I guess the problem lies on the fact that I gave my optionfields the SAME group name. But to allow my customers easily change their choices of option, I have to give the optionfields of ONE QUESTION the same 'group name' but different values. Then, how can I transfer only the selected option as hidden and finnaly to the file on the server? Thanks Below is the script and note from Jim 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[i].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=""> |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

