Moss 0

From what I understand this is a bad idea but here is my situation.

I have a table of search results and on the left side each row has a checkbox (like GMail) so you can perform batch operations. I want to be able to treat the entire result table as a form. However each row can be expanded to reveal data that can be edited. In this case I want to treat the row as a form. I want to be able to submit and reset etc. just that row. Multiple rows can be expanded at once by the way.

1 answer

0
points

I don't know if this is the most efficient method, but you might consider designing the page so that when one row is selected, the table ceases to be a form. This would leave the only actual form on the page being the single row until that row is finished being edited. This would be accomplished (as with all good forms) by coding it into the PHP first, and then adding JavaScript with AJAX to polish it. Your idea already requires dynamic scripting, so simply removing the old <form> tags and placing the new ones inside of the row shouldn't be much trouble. Just remember to make all the <label>, <fieldset>, etc. are dynamic also.

Answered over 6 years ago by kainosnous
  • Yeah, I'm afraid I might have to do that, but I don't like it. Seems like it would be very easy to become buggy. I think I will try to see if I can get away with nested forms first. This is for a database editing backend, not a public facing page so I don't need wide browser support necessarily. I'm not sure what you mean about coding in PHP first and polish with AJAX. Are you talking about progressive enhancement? I'm not sure how that would work in this case. Wouldn't creating and destroying forms have to be done with javascript? Moss over 6 years ago