I have a web form created by converting an excel spreadsheet to html with several onClick events, specifically "Clear" (clears data), "Submit" (emails data) and "Save Draft" (saves draft lcoally). Customers input their data, the from works its magic and is then sent off per the clicks. User is not signed on so no session data is currently handled.
I need to make the following changes:
-Capture user session data with which to id each file when saved/submitted.
-I need to change "Save Draft" to save the draft to the server rather than the local computer.
-I need to save the finished html to the server as well as sent via email on "Submit".
Currently the forms handling this are html itself:
Expand|Select|Wrap|Line Numbers
- <input id='clearBtn' class=button type=button value=' CLEAR ' onClick='return clearForm();' onfocus='return hilite(this.id);'>
- <input id='submitBtn' class=button type=button value='SUBMIT' onClick='return submitForm();' onfocus='return hilite(this.id);'>
- <input id='saveBtn' class=button type=button value=' SAVE DRAFT ' onClick='return saveForm();' onfocus='return hilite(this.id);'>
- <input name='emailTo' type=hidden value='service@cassandrasvox.com'>
- <input name='emailFrom' type=hidden value='info@nutritionfactslabelservices.com'>
- <input name='emailSubject' type=hidden value='Scaled Recipe'>
- <input name='emailAttachment' type=hidden value='ScaledRecipe'>
- <input name='submitMessage' type=hidden value=''>
- <input name='nextPage' type=hidden value=''>
- <input id='formTitle' name='formTitle' type=hidden value='ScaledRecipe'>
- <input id='formHtml' name='formHtml' type=hidden><!-- end -->
Expand|Select|Wrap|Line Numbers
- function saveForm(){var a="To save this file on your local machine, click OK and wait for the page to refresh.";a+="\nThen, using the File..Save As menu option, save the file using any name you choose.";alert(a);a=getElementsByTagNames("input,select");for(i=0;i<a.length;i++){var b=a[i].id,c=b.substr(1);document.getElementById(c)!=null&&(c=getCellValue(c),document.getElementById(b).setAttribute("data-default",c))}a="<html>"+document.getElementsByTagName("html")[0].innerHTML+"</html>";with(document.forms[0])formHtml.value=
- escape(a),action=version+"/workSave.asp",method="post",submit();return!0}function printForm(a){a!=""&&alert(a.replace(/\<br\>/gi,String.fromCharCode(10)));window.print()}function formatNumber(a,b){if(isNaN(parseFloat(a)))return 0;var c=b.match(/\.(0*)/mg);return number_format(a,c==null?0:c[0].toString().length-1)}
Expand|Select|Wrap|Line Numbers
- <%
- on error resume next
- worksheet = unescape(request("formHtml"))
- response.write(worksheet)
- response.end
- %>
I have gotten as far as seeing that the file will need to be saved into a server directory and at least 2 mySQL tables updated.
I just can't wrangle the code.
Code examples? Directions? HELP?!
Thanks folks!