From: Asaf Asaf Date: 2008-10-23T18:42:21+09:00 Subject: Re: using buttons in CGI Brian Candler wrote: > 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. Hi Brian, as I see the value of the submit button doesn't pass to the next form, I see that when I using HTML page and pressing on the 'submit button'. so, I understand that I should check it not by using cgi.params[..][], but by other command. can you tell me if what I am say is right ? and if so can you tell me hoe to check the value of the submit button. another question : if I want that one of the submit buttons will update the current form with the adittional line, and the other submit button will update other form, how can I do it using only one form and two submit buttons ? I appriciate your quick answer, Thanks, Asaf -- Posted via http://www.ruby-forum.com/.