Populate data in modal form from clicked row

Populate data in modal form from clicked row

dmolavidmolavi Posts: 65Questions: 0Answers: 0
edited June 2011 in General
I have a table that has 5 columns presented to the user. I want to enable the user to click on a row, followed by an "edit" button, and have a modal dialog appear that has a form which enables the user to edit not only the 5 values in the table, but other values that are stored in the database but not presented in the table.

Thus far, I have the ability to highlight the row clicked, get the item ID of the row, and show a blank form in the modal dialog. How can I go about populating the fields in the dialog?

One tricky part: some of the form fields in the dialog are dropdown boxes that pull their values from a separate table from the table in which the item itself is stored (ie, the item has a manufacturer, and in the item table, the manufacturer is an index into the manufacturer table, which lists the actual manufacturers).

It would be easiest if there were a way for the js to call a php file that could do the heavy lifting in the database.

Is there any way to accomplish this?

Replies

  • janrusselcalachanjanrusselcalachan Posts: 10Questions: 0Answers: 0
    Same problem here.
  • dmolavidmolavi Posts: 65Questions: 0Answers: 0
    I have resolved this. See http://www.modeltraintracker.com/sandbox and examine the code.
  • skyetechskyetech Posts: 10Questions: 0Answers: 0
    dmolavi, thanks for the link. I especially like being able to add new records to the dropdowns. However, the edit form isn't being populated from the database using Chrome 16.0.912.77 m. Works in IE9 though.
  • dmolavidmolavi Posts: 65Questions: 0Answers: 0
    I haven't tested in Chrome, though I probably should. Does Chrome have a Firebug-like extension available to it for debug?
This discussion has been closed.