Jump to content

javascript/onclick... table cells


BrianM

Recommended Posts

Well, back to the help board for me with yet another question. I'm still working on the same website for my fathers engineering company. Each project page for the client had a table on it listing all the information from the project table in the database pertaining to that certain project; permit status, a date certain things are submitted to know if this or that was complete, county meeting dates, etc.) so here's a little about what I'm trying to do. I want each cell on the table to be a link, which I already know how to do this, but here's the part I'm unsure of. I want to be able to click the cell and after clicking it an input box with a submit button pops up right under the table for the cell clicked so that it updates the cell contents with whatever you insert and submit, that is the part I'm unsure of. I was thinking to get the submittal text box to pop up under the table for whatever cell you click I may have to use some sort of a javascript onClick event that I read about on w3schools, although I'm not quite sure, maybe somebody could fill me in on how this might be done. I hope I've shared enough information for somebody to give me some feedback as to how this could be done.

 

Thanks for any help!

 

8)

Link to comment
Share on other sites

I don't see how this will update content being listed from a database. What I was wondering was how would I go about clicking the cell content a having an input box and submit button pop up under the table for that column and row and click the submit button and whatever was put into the input box replaces the content in the cell, kind of like an error that pops up on the screen when you submit wrong/invalid information or forget to complete a field when filling out a form a notice pops up saying you forgot to do this or that, how would I do that but instead of text, have a submit form for that cell to update the contents.

Link to comment
Share on other sites

Well I'm trying to work with the script you provided, but I'm having a bit of trouble figuring out how it makes a connection to the database to update the cell content after using the ajax_inplaceeditor. Any advice? :|

Link to comment
Share on other sites

Do you at least have the in place editor piece working? that is the tough part. Your JS should look like this:

 

<script type="text/javascript">
new Ajax.InPlaceEditor('some_element_id', 'update_item.php?name=some_element');
</script>

 

Then, you have your PHP file:

<?php
  $name = $_GET['name'];
  $value = $_POST['value'];

  //Do what ever with it here (like store it in a DB)

  echo $value; //Echo it back
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.