Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    May 2010
    Posts
    6
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Saving user input

    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.

    Code:
    <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!

  • #2
    Senior Coder Dormilich's Avatar
    Join Date
    Jan 2010
    Location
    Behind the Wall
    Posts
    3,248
    Thanks
    12
    Thanked 340 Times in 336 Posts
    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.
    Last edited by Dormilich; 06-15-2010 at 01:43 PM.
    The computer is always right. The computer is always right. The computer is always right. Take it from someone who has programmed for over ten years: not once has the computational mechanism of the machine malfunctioned.
    André Behrens, NY Times Software Developer

  • #3
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,852
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    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.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #4
    New to the CF scene
    Join Date
    May 2010
    Posts
    6
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Great,
    Thank you everybody.
    So much to learn, so little time!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •