From: Brian Candler Date: 2008-10-23T18:07:16+09:00 Subject: Re: using buttons in CGI Asaf Asaf wrote: > I have a problem, I have table such that each line on it is textfield > (something that I defined). I want to make a button, which isn't the > 'submit' or 'reset' button, such that when I click on it, a new line on > this table will be made. > After big number of attempts I succeed making two forms, such that on > one form I have 'submit' button, that clicking on it update the page > with a new line, my problem is : if someone write something on the table > (on one of the text-fields) then clicking on this button won't save the > data that he entered. and because the 'submit' button that responsable > to the new line isn't in the form of the table, I can't get the data of > the table using cgi.params[...] after the refreshing of the page with > the new line. You just need another submit button within the original form, something like this (untested):

Then in your CGI you check the value of the "submit" parameter to see whether it was "new row", in which case you perform the alternate action of re-rendering the form with an additional row. For more info go to www.w3.org, click on "HTML" in the left-hand side, then under "What" click "HTML 4.01", then click on "Forms" (17) in the quick table of contents. This will let you navigate to: http://www.w3.org/TR/html401/interact/forms.html#submit-button www.w3.org is an excellent resource for anything about HTML, XML, CSS etc. -- Posted via http://www.ruby-forum.com/.