Forums / Setup & design / Nested forms

Nested forms

Author Message

Alejandro Serrano

Friday 26 January 2007 3:10:20 pm

Hi,
In our web site we have a feature for weblogs. In a weblog entry, we include any comments made to them. Each comment includes an "Edit" button, and the entire entry contains another "Edit" button.
The problem is that when I click "Edit" on a comment, I'm redirected to edit the entry instead of the comment. I think that the problem is that there are two nested forms, and the browser gets the information from the outer, that is the entry, instead of the inner.
Is there any way to achieve this functionality? I need to have a main form surrounding the entire entry+comments so I can remove comments.

Thanks in advance,
Alejandro Serrano

Ville Mattila

Sunday 28 January 2007 9:33:49 am

HTML does not allow nested forms, so you have to close another form before defining a new one. You said that you must have nested forms to be able to remove comments. It's impossible, so you should move the comment removal functionality in the same script as editing comments. I do not see any reason why it wouldn't be possible.

Ville

---

<form action="blog/edit">
<!-- Blog Message -->
</form>

<form action="comment/edit">
<input type="hidden" value="commentid" value="1">
<!-- Comment 1 -->
</form>

<form action="comment/edit">
<input type="hidden" value="commentid" value="2">
<!-- Comment 2 -->
</form>