473,699 Members | 2,361 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Hide form submit button value

Hello.

Here's my example form:

<form method="get" action="">
<p>
<input type="radio" name="radio_exa mple" id="radio1"
value="radio1_v al" />
<label for="radio1">ra dio button one</label>
</p>
<p>
<input type="radio" name="radio_exa mple" id="radio2"
value="radio2_v al" />
<label for="radio2">ra dio button two</label>
</p>
<p>
<input type="submit" name="submitfor m" id="submitform "
value="caption" />
</p>
</form>

When submitting this form with the specified GET method you'll get an
URL like this (http://foo.bar/form.php being the form's URL):
http://foo.bar/form.php?radio_exampl...itform=caption

Now I want to avoid that the submit button's value is also passed to
the URL, so I would only get this URL when submitting the form:
http://foo.bar/form.php?radio_example=radio1_val

Is this possible?
Jun 2 '08 #1
10 7413
k3pp0 schreef:
Hello.

Here's my example form:

<form method="get" action="">
<p>
<input type="radio" name="radio_exa mple" id="radio1"
value="radio1_v al" />
<label for="radio1">ra dio button one</label>
</p>
<p>
<input type="radio" name="radio_exa mple" id="radio2"
value="radio2_v al" />
<label for="radio2">ra dio button two</label>
</p>
<p>
<input type="submit" name="submitfor m" id="submitform "
value="caption" />
</p>
</form>

When submitting this form with the specified GET method you'll get an
URL like this (http://foo.bar/form.php being the form's URL):
http://foo.bar/form.php?radio_exampl...itform=caption

Now I want to avoid that the submit button's value is also passed to
the URL, so I would only get this URL when submitting the form:
http://foo.bar/form.php?radio_example=radio1_val

Is this possible?
Hi,

Leave out the name of the submitbutton.
I think only named formelements are actually send.

I must add I cannot see any reason to leave that part out, but well...
that is just me.

Regards,
Erwin Moller
Jun 2 '08 #2
Erwin Moller a écrit :
I think only named formelements are actually send.
I confirm, plus I add that it's not PHP related at all ;)

Regards,
--
Guillaume
Jun 2 '08 #3
On 17 Apr, 10:48, Guillaume <ggra...@NOSPAM .gmail.com.INVA LIDwrote:
Erwin Moller a écrit :I think only named formelements are actually send.

I confirm, plus I add that it's not PHP related at all ;)

Regards,
--
Guillaume
Hey Guillaume, that's Jerry's job!
Jun 2 '08 #4
..oO(Erwin Moller)
>When submitting this form with the specified GET method you'll get an
URL like this (http://foo.bar/form.php being the form's URL):
http://foo.bar/form.php?radio_exampl...itform=caption

Now I want to avoid that the submit button's value is also passed to
the URL, so I would only get this URL when submitting the form:
http://foo.bar/form.php?radio_example=radio1_val

Is this possible?

Hi,

Leave out the name of the submitbutton.
I think only named formelements are actually send.

I must add I cannot see any reason to leave that part out, but well...
It keeps the URL shorter and is not really necessary for the form
processing.

Micha
Jun 2 '08 #5
k3pp0 wrote:
Now I want to avoid that the submit button's value is also passed to
the URL, so I would only get this URL when submitting the form:
http://foo.bar/form.php?radio_example=radio1_val

Is this possible?
Just drop this control before submitting:

<HTML>
<BODY>
<FORM onSubmit="var d=this.toDrop;d .parentNode.rem oveChild(d);">
<INPUT NAME="toLeave">
<INPUT NAME="toDrop" TYPE="SUBMIT">
</FORM>
</BODY>
</HTML>
Jun 2 '08 #6
Greetings, Alexey Kulentsov.
In reply to Your message dated Friday, April 18, 2008, 12:16:14,
k3pp0 wrote:
>Now I want to avoid that the submit button's value is also passed to
the URL, so I would only get this URL when submitting the form:
http://foo.bar/form.php?radio_example=radio1_val

Is this possible?
Just drop this control before submitting:
<HTML>
<BODY>
<FORM onSubmit="var d=this.toDrop;d .parentNode.rem oveChild(d);">
<INPUT NAME="toLeave">
<INPUT NAME="toDrop" TYPE="SUBMIT">
</FORM>
</BODY>
</HTML>
Why not get it straight?

<HTML>
<BODY>
<FORM>
<INPUT NAME="toLeave" value="Form data goes here"/>
<INPUT TYPE="SUBMIT" value="Click me!"/>
</FORM>
</BODY>
</HTML>

Rule is simple: don't give name to element if you do not want to see it's
value passed to the script...

And it is not entirely PHP question... But it is related to PHP as you must
know what kind of data you will get from what kind of form elements...

Note: unchecked checkboxes does not provide any data to server too. If you
want to see them even if they are not checked, that's work for some kind
of javascript in form processing.
--
Sincerely Yours, AnrDaemon <an*******@free mail.ru>

Jun 27 '08 #7
..oO(AnrDaemon)
>Note: unchecked checkboxes does not provide any data to server too. If you
want to see them even if they are not checked, that's work for some kind
of javascript in form processing.
Nope, JS is unreliable. You should use some better server-side form
processing to keep track of the initial checkbox value. If it's then
missing in the form submission, you can safely assume it was unchecked.

Micha
Jun 27 '08 #8
Greetings, Michael Fesser.
In reply to Your message dated Tuesday, June 10, 2008, 04:19:03,
>>Note: unchecked checkboxes does not provide any data to server too. If you
want to see them even if they are not checked, that's work for some kind
of javascript in form processing.
Nope, JS is unreliable. You should use some better server-side form
processing to keep track of the initial checkbox value. If it's then
missing in the form submission, you can safely assume it was unchecked.
Interesting offer... can't remember if I have tested such possibility...
Ok, tested... it does not change the core issue. If you have some value
assigned to checkbox, it will be sent to script instead of default "on" text.
And that's all. I will not rely on that value in any of my project, just in
case some lame browser will eventually send me "on" instead of that value.
--
Sincerely Yours, AnrDaemon <an*******@free mail.ru>

Jun 27 '08 #9
AnrDaemon <an*******@free mail.ruwrites:
>>>Note: unchecked checkboxes does not provide any data to server too. If you
want to see them even if they are not checked, that's work for some kind
of javascript in form processing.
>Nope, JS is unreliable. You should use some better server-side form
processing to keep track of the initial checkbox value. If it's then
missing in the form submission, you can safely assume it was unchecked.

Interesting offer... can't remember if I have tested such possibility...
Ok, tested... it does not change the core issue. If you have some value
assigned to checkbox, it will be sent to script instead of default "on" text.
And that's all. I will not rely on that value in any of my project, just in
case some lame browser will eventually send me "on" instead of that value.
Quite the opposite. It would appear that "on" is a default value being used if
you fail to provide one. If you don't want to rely on the values, perhaps the
simpler solution is to just check if the corresponding "name" is set. Note,
however, that checkboxes are similar to radio boxes and normally all radio
boxes in a group are given the same name and different values.
--
Chetan
Jun 27 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
23883
by: Owen Funkhouser | last post by:
I have a form with three radio options. And I have three buttons: <input type="submit" name="mainform_action" value="Edit Data"> <input type="submit" name="mainform_action" value="View Data"> <input type="submit" name="mainform_action" value="Delete Data"> If the first radio button is selected, I only want all three buttons to be visible to the user. If the second radio button is selected, I only want the "Edit Data" and "View Data"...
3
16542
by: earl | last post by:
Hey Say I have two <form> on a page like this : <form action="private.asp" method="post" name="form1"> // code <input type=submit value="submit" name="submit"> </form> <form action="private2.asp" method="post" name="form2">
15
6572
by: M Smith | last post by:
I have a form I want to submit to itself. I want to be able to type in a list of numbers and submit the form and have that list show up on the same form under the text box I typed them into and the buttons. The problem is when I post a form to itself, the Enter key will not submit the form, it only clears the contents of the text box. The only way I can submit is to click the submit button. Here is a simplified version of my code that I...
1
11932
by: Don Grover | last post by:
I have a table thats wrapped in a div tag, that when user selects 1 of 2 radio buttons it hides or shows table, this works ok. But I want to set the table show hide on what the existing state of radio buttons are on page load aswell, so if one button is allready selected then the table is hidden else it is shown, can some help me with this, Existing code below Regards Don. '**************** <html>
9
2766
by: sergio | last post by:
Hi all, I have created the following script that will show/hide a menu based on checkboxes. It works fine in Opera but not on IE6! Does anybody knows a workaround this problem? Thanks for your response. Sergio ------------------------------------------------ <script language="JavaScript" type="text/javascript">
10
13454
by: DettCom | last post by:
Hello, I would like to be able to display or hide fields based on whether a specific Yes/No radio button is selected. This is in conjunction with a posting a just made here in the same group related to checkboxes. Thanks!!!
5
2176
by: Zambien | last post by:
Hi all, Here's my problem. I have tables that are using the menu/submenu idea for hiding rows. This works fine in IE (of course) and does show/hide correctly in netscape, but as soon as the shown method is called, the table gets skewed and the presentation of the data on the page goes horribly wrong. I don't think this is a table issue as I have spent alot of time staring at this code. Here is the html...
12
2767
by: ATS | last post by:
I need to hide/reveal parts of a web page using javascript. I think I can do with using the <span> tag, but I've been away from it for a while and don't remember. Any pointers, examples?
4
21011
by: devine | last post by:
Hi All, I am VERY new to Javascript. I have been provided with some code, which will enable me to hide/show a text area and change a submit button dependant on a check box. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
0
8705
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9199
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9054
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8943
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8899
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6550
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5884
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3075
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2362
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.