Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > more submit buttons?

Reply
Thread Tools

more submit buttons?

 
 
roN
Guest
Posts: n/a
 
      08-16-2005
Hi,
I show the content of a MySQL Table in a select box.
Below the select box is a text field.
I want to add the text that is clicked in the select to the text field. how
do I do that?
and then I want to be able to have two buttons: 'Add' and 'Remove' to add an
entry to the table or remove the one that is written in the text field. how
would I do that?
Thank you!

--
chEErs roN
I'm root. I'm allowed to do this!
keep on rockin'


 
Reply With Quote
 
 
 
 
Jukka K. Korpela
Guest
Posts: n/a
 
      08-16-2005
"roN" <(E-Mail Removed)> wrote:

> I show the content of a MySQL Table in a select box.
> Below the select box is a text field.
> I want to add the text that is clicked in the select to the text field.
> how do I do that?


You can't do that in HTML. You might be able to do that using your favorite
scripting language, client-side or server-side. But what has this got to do
with more submit buttons?

> and then I want to be able to have two buttons: 'Add' and 'Remove' to
> add an entry to the table or remove the one that is written in the text
> field. how would I do that?


Multiple submit buttons work unreliably if a form contains a text input
field, since hitting Enter in that field may trigger form submission as if
one of the buttons had been used - and that button could be the 'Add'
button on odd days, the 'Remove' button on even days.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html


 
Reply With Quote
 
 
 
 
roN
Guest
Posts: n/a
 
      08-17-2005
Jukka K. Korpela wrote:
> "roN" <(E-Mail Removed)> wrote:
>
>> I show the content of a MySQL Table in a select box.
>> Below the select box is a text field.
>> I want to add the text that is clicked in the select to the text
>> field. how do I do that?

>
> You can't do that in HTML. You might be able to do that using your
> favorite scripting language, client-side or server-side. But what has
> this got to do with more submit buttons?


Yes, I think I'll do that in Javascript. It's even faster than any
server-side language...

>> and then I want to be able to have two buttons: 'Add' and 'Remove' to
>> add an entry to the table or remove the one that is written in the
>> text field. how would I do that?

>
> Multiple submit buttons work unreliably if a form contains a text
> input field, since hitting Enter in that field may trigger form
> submission as if one of the buttons had been used - and that button
> could be the 'Add' button on odd days, the 'Remove' button on even
> days.


So how would you solve this problem?
Thank you for suggestions!

--
chEErs roN
I'm root. I'm allowed to do this!
keep on rockin'


 
Reply With Quote
 
Adrienne
Guest
Posts: n/a
 
      08-17-2005
Gazing into my crystal ball I observed "roN" <(E-Mail Removed)> writing
in news:(E-Mail Removed):

> Jukka K. Korpela wrote:
>> "roN" <(E-Mail Removed)> wrote:
>>
>>> I show the content of a MySQL Table in a select box.
>>> Below the select box is a text field.
>>> I want to add the text that is clicked in the select to the text
>>> field. how do I do that?

>>
>> You can't do that in HTML. You might be able to do that using your
>> favorite scripting language, client-side or server-side. But what has
>> this got to do with more submit buttons?

>
> Yes, I think I'll do that in Javascript. It's even faster than any
> server-side language...
>


What about users without javascript? What about SQL injection? You HAVE to
check serverside to make sure someone isn't doing something bad.

>>> and then I want to be able to have two buttons: 'Add' and 'Remove' to
>>> add an entry to the table or remove the one that is written in the
>>> text field. how would I do that?

>>
>> Multiple submit buttons work unreliably if a form contains a text
>> input field, since hitting Enter in that field may trigger form
>> submission as if one of the buttons had been used - and that button
>> could be the 'Add' button on odd days, the 'Remove' button on even
>> days.

>
> So how would you solve this problem?
> Thank you for suggestions!


You test for the value of each submit button.
<input type="submit" value="Add" name="add">
<input type="submit" value="Delete" name="delete">

Depending on which one, you confirm to the user before committing the
change. You could do the confirm with javascript or server side. Here's a
simple example in ASP:

<% dim add, delete, confirm, isadd, isdelete, isconfirmed, confirmadd,
confirmdelete

if not isconfirmed then
if request.form("add") = "add" then
isadd = true
isconfirmed = true
elseif request.form("delete") = "delete" then
isdelete = true
isconfirmed = true
end if
else
if request.form("confirm") = "Confirm Addition" then
'do your insert
elseif request.form("confirm") = "Confirm Deletion" then
'do you delete
else
'throw an error
end if
end if
%>
<% if not isconfirmed then %>
<form method="post" action="<%=request.servervariables("script_name")% >">
<p>
.......
<input type="submit" value="add" name="add">
<input type="submit" value="delete" name="delete">
</form>
<% else %>
<form method="post" action="<%=request.servervariables("script_name")% >"
<% if isadd then %>
<p>You are about to add the following...
<input type="submit" value="Confirm Addition" name="confirm">
</p>
<% end if%>
<% if isdelete then %>
<p>You are about to delete the following...
<input type="submit" value="Confirm Deletion" name="confirm">
</p>
<% end if %>
</form>
<%end if%>


--
Adrienne Boswell
http://www.cavalcade-of-coding.info
Please respond to the group so others can share
 
Reply With Quote
 
Jukka K. Korpela
Guest
Posts: n/a
 
      08-17-2005
"roN" <(E-Mail Removed)> wrote:

> So how would you solve this problem?


I wouldn't create it in the first place. Did I say this too implicitly?
Simply use one submit button. Use other controls to let the user select an
action.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html


 
Reply With Quote
 
roN
Guest
Posts: n/a
 
      08-17-2005
Jukka K. Korpela wrote:
> "roN" <(E-Mail Removed)> wrote:
>
>> So how would you solve this problem?

>
> I wouldn't create it in the first place. Did I say this too
> implicitly? Simply use one submit button. Use other controls to let
> the user select an action.


But If it would work I think it would have been the best version if you have
one select-box with several entries to add some new or the delete or either
to edit them...... annother good idea?

--
chEErs roN
kEEp on rockin'


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
STRUTS- <html:submit> does not submit on pressing Enter key Megha Vishwanath Java 2 10-02-2009 12:52 PM
Catching Submit Event even called by document.forms[0].submit() The Crow ASP .Net 2 09-27-2005 05:03 PM
submit the form data to the popup window without a submit button jrefactors@hotmail.com HTML 2 01-01-2005 06:07 AM
Preventing Multiple submit (Disabling Submit Button Post Click) Solution Mark ASP .Net 1 12-13-2004 08:03 PM
Disable Submit Button on Post back and On Submit in ASP.net Ghafran Abbas ASP .Net 0 10-12-2004 06:11 PM



Advertisments