Connecting Tech Pros Worldwide Forums | Help | Site Map

Changing text within a td to make it become an input field, and then submitting data

Newbie
 
Join Date: Jul 2009
Posts: 2
#1: Jul 13 '09
I'm trying to come up with a solution (but with no real direction to start with) where I'm trying to edit data in a td element of a table on the spot. What I want to do is when a td element containing text is clicked on, the text within this td becomes an input text field. The data within the text field, upon submission, be it via a button or enter or whatever, will be the new data within the td element after submission. Is there a viable solution to do this? Much apprecated for the help

Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,664
#2: Jul 13 '09

re: Changing text within a td to make it become an input field, and then submitting data


is there anything with the data to happen server-side? if not then you wouldn't need any need of submission.
Newbie
 
Join Date: Jul 2009
Posts: 2
#3: Jul 14 '09

re: Changing text within a td to make it become an input field, and then submitting data


Well the thing that im mainly concerned about is the changing of the elements, but yes, the data needs to be changed server side via SQL server database
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,664
#4: Jul 14 '09

re: Changing text within a td to make it become an input field, and then submitting data


well then. the obvious thing to try is cutting out the text node(s), inserting an input element and pasting the cut text as default value. this may be different throughout the browsers, depending on the Javascript implementation (i.e. I expect IE to be less programmer friendly than the others).

whether to use a form submit or an AJAX call to send the data to the server depends on your liking.
Reply

Tags
html, javascript