Print Page | Close Window

Enabling the UI to save edits to table ce

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=3667
Printed Date: 29 March 2026 at 11:56pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Enabling the UI to save edits to table ce
Posted By: TDee
Subject: Enabling the UI to save edits to table ce
Date Posted: 19 June 2003 at 11:00am

I'm creating a page that allows a user to edit a schedule.  The schedule is a table.  I found out how to create editable tables, but what good is editing tables if the updates go away when you reload the page

So, what I want to do is allow updates to be made to individual table cells and save the changes so others can view the updated table from a different location.  Hope that made sense.

I found some code that allows me to create a user editable web page and save the imput.  But the code uses a <div> tage and a table cannot be rapped with a <div> tab.  At least not in this example. Here is the code.  Read the description below the code if you don't fell like figuring out what it is doing.

-----------------------------------------------------------------

<head>
<style> .userData {behavior:url(#default#userdata);} </style>
<script for=window event=onload>
 DoLoad();
</script>
<script for=window event=onbeforeunload>
  DoSave();
</script>
<script>
function DoSave(){
  One1.setAttribute("content", One1.innerHTML);
  One1.save("EditContent");
}
function DoLoad(){
  One1.load("EditContent");
  content = One1.getAttribute("content");
  if (content != null) One1.innerHTML=content;
}
function DoClear(){
  One1.innerHTML = "";
}
</script>

</head>
<body>
<p align=center>
  <button onClick='DoSave()'>Save</button>
  <button onClick='DoClear()'>Clear</button> 
  <button onClick='DoLoad()'>Load</button>
</p>
<div class=userData id=One1 contentEditable=true> </div>

</body>

</html>

---------------------------------------------------------------

This allows me to have a blank page with three buttons on top: save, load, clear.  the user can type away and save it.  when they come back the writting is still there, great. But, I don't want a blank page of typing, I want to format what a user puts in with a table.

So, basically I want to make each cell of the table an instance of the above code.   But, I don't want to write the above code for each cell and I want to reuse the buttons (save, load, clear) for each cell.

This is were I need help

  1.   I'd like to write a script that will identify the cell or Div ID a user has clicked in to be update.  
  2. Next I need to pass that information into a fucntion that contains the above code and will replace the above occurances of "one1" with the div ID.

In theory I believe this will allow me to update each cell individually and save the content for later viewing.

Sorry so long,  Any help would bo awsome.  thanks.




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net