...

View Full Version : Saving user input



goisisi
06-15-2010, 11:28 AM
Is there any possible way for JS to save changes that a user has made?

my situation is that I'm a photographer who offers photobooks. My customers often have hundreds or thousands of photos and want captions on lots of them. I want to post a photo gallery with a user input form. I've created a simple form, but I want the user to be able to save comments straight to the gallery so I can look at them...

it's only a very simple form and isn't quite finished yet, oh by the way, I'm not sure how to use the check box... but, i'll work on that.


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
<style type="text/css">
<!--
#divWrapper {
text-align: center;
width: 430px;
margin-right: auto;
margin-left: auto;
}
-->
</style>
</head>

<body>
<script type="text/javascript">
function picForm()
{
if(document.frmInput.addPic.value="yes")
{
document.frmOutput.outChoice.value="will"
}
else
{
document.frmOutput.outChoice.value="will NOT"
}
document.frmOutput.outCap.value=document.frmInput.addCap.value;
document.frmOutput.outComm.value=document.frmInput.addComm.value;
}
</script>
<div id="divWrapper">
<p>Uncheck the box if you do NOT want this photo to appear in your photobook. Please write your caption in the box provided. Any further comments you wish to make can be entered in the second box.</p>
<div id="divInput">
<form name="frmInput">
<table id="tblForm" cellpadding="3px">
<tr>
<td><input name="addPic" type="checkbox" value="yes">
Add to Photobook</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>Caption<br>
<textarea name="addCap" cols="24" rows="3" value="...Add Caption Here..."></textarea></td>
<td>Comments<br>
<textarea name="addComm" cols="24" rows="3" value="...Add Comments Here..."></textarea></td>
</tr>
<tr>
<td></td>
<td><div align="right">
<input name="btnSubmit" type="button" value="Submit" onClick="picForm()" />
</div></td>
</tr>
</table>
</form>
</div>
<div id="divOutput">
<form name="frmOutput">
<p>This photo
<input name="outChoice" type="text" value="" size="7" style="border:0px" />
appear in your photo book.</p>
<p>You would like the caption to read:
<input name="outCap" type="text" value="" size="50" style="border:0px" />
</p>
<p>Your comments to us are:
<input name="outComm" type="text" value="" size="50" style="border:0px" />
</p>
</form>
</div>
</div>
</body>
</html>

Please help!

Dormilich
06-15-2010, 12:12 PM
small amounts of text you can save in a cookie, but anything that should be saved along with your site (like comments) must be done server-side.

abduraooft
06-15-2010, 12:13 PM
I've created a simple form, but I want the user to be able to save comments straight to the gallery so I can look at them...
Surely, javascript is a client side language and thus it's not capable to do such actions by itself. You'd need to use some serverside language like PHP/ASP and a database like Mysql/Mssql.

goisisi
06-16-2010, 05:57 AM
Great,
Thank you everybody.
So much to learn, so little time!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum