Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old November 1st, 2004, 04:30 PM
Registered User
Join Date: Nov 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default HELP with text boxes on webpage

It's been a long time since i've gotten to play around with webpage creation. I am using .NET to create an intranet page for work. I have a part on the site with 3 text boxes and 1 save button. What I am wanting to do is when the user types in the "Contacts" and clicks the save button I want it to display what was typed in and save it so that when they view the page the content is always there.

I know a few things that I need...but I would greatly appreciate an example of this being done on a webpage. It doesnt matter whether it's in a VBScript or JAVAScript.
Old November 2nd, 2004, 04:32 AM
joefawcett's Avatar
Wrox Author
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts

Well you two basic choices, do you want to save onto the server or onto the client, normally the server is best as otherwise your user will need to have low security settings for your site and they will only see their details if they use the same machine or you could use cookies which maybe disabled.

To save on the server you have two basic choices again, save to a full scale database, SQl Server, Oracle, Access etc. or just to a text file, maybe an XML file would be easier. Your decision depends on what software you have, how much data you intend to have (counting all users) and what you need to do with the data, is it just for the user or are you going to want to run reports and queries against it?
It seems like an overkill to use a database for just three names so an XML file might be easier.
As you are writing in .NET then it is simply a matter of checking, in the page load, whether this is a postback due to the save button being clicked or having an onclick on the save button. Then read the three values and construct an XML representation, something like:
  <contact>Joe Fawcett</contact>
  <contact>George W. Bush</contact>
  <contact>John Kerry</contact>
Load this into an XmlDocument using LoadXml method and then save to a file using the login name of the use, e.g., fawcettj.xml.
The next time the page is loaded check if the xml file exists and if so load and read the contacts to populate the textboxes.


Joe (Co-author Beginning XML, 3rd edition)

Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert text into webpage textbox vutaviva C# 1 November 26th, 2006 08:16 PM
Cycling through all text boxes sjf905 C# 2 September 21st, 2006 12:43 AM
Rich Text Boxes speedlearner All Other Wrox Books 1 June 22nd, 2006 08:04 AM
Using integers with text boxes clojinted General .NET 1 February 19th, 2005 08:12 PM
Form Text Boxes mrideout BOOK: Beginning ASP.NET 1.0 8 September 3rd, 2004 12:43 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.