Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Enabling the UI to save edits to table ce
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Enabling the UI to save edits to table ce

 Post Reply Post Reply
Author
TDee View Drop Down
Newbie
Newbie


Joined: 19 June 2003
Location: United States
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote TDee Quote  Post ReplyReply Direct Link To This Post Topic: Enabling the UI to save edits to table ce
    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.

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.