473,568 Members | 3,014 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Submit a form with hyperlink

Hello All!

Is it possible to submit a form using hyperlink? I want to send hidden element
when a link is clicked. I read some books, but I found only using button which I
don't want to use.

Thanks in advance.
Jul 20 '05 #1
4 34930
ry**@yokoyama.w s wrote in
news:MP******** *************** *@news.corenews .com:
Hello All!

Is it possible to submit a form using hyperlink?
Not in HTML.
I want to send
hidden element when a link is clicked. I read some books, but I found
only using button which I don't want to use.


So you want a hyperlink to submit a form that _only_ has a hidden field?
As in, the user doesn't type anything? They way you do this is with the
URL:

Say you wanted to send the data in two hidden fields:
<input type="hidden" name="blah" value="clam">
<input type="hidden" name="blegh" value="homestar ">

Just drop the hidden fields and put it in a URL like this, making sure to
escape the ampersand with &amp;:

<a href="path/pagename.extens ion?blah=clam&a mp;blegh=homest ar">Linky
Linky</a>

However, if you want to submit a form in which a user enters any sort of
input, then a button is the way to go.

--
In a room with thirty-seven people, never have everybody shake each
other's hand.
Jul 20 '05 #2
you can use Javascript :

<form name="myForm" method="post" action="myscrip t.pl">
<input type="hidden" value="10">
</form>
<script language="javas cript>
document.myForm .submit();
</script>

ry**@yokoyama.w s wrote:
Hello All!

Is it possible to submit a form using hyperlink? I want to send hidden element
when a link is clicked. I read some books, but I found only using button which I
don't want to use.

Thanks in advance.


Jul 20 '05 #3
Greg Griffiths wrote:
you can use Javascript :

<form name="myForm" method="post" action="myscrip t.pl">
<input type="hidden" value="10">
</form>
<script language="javas cript>
document.myForm .submit();
</script>


I think you meant something more like:
<script language="javas cript>
function submit() {
document.myForm .submit();
}
</script>
....
<a href="javascrip t:submit();">su bmit</a>

However, don't do this unless you provide a button as a fall back.
Better yet, just use a button, and use CSS to style so it looks like a
link. Other than the presentation, I can't imagine any reason for using
a link instead of a real button.

--
Lachlan Hunt
http://www.lachy.id.au/

Please direct all spam to ab***@127.0.0.1
Thank you.
Jul 20 '05 #4
Lachlan Hunt wrote:
I think you meant something more like:
<script language="javas cript>
Oops, that should have been:
<script type="text/javascript">
or
<script type="applicati on/x-javascript"> (this one does not work in IE)
function submit() {
document.myForm .submit();
}
</script>
...
<a href="javascrip t:submit();">su bmit</a>

However, don't do this unless you provide a button as a fall back.
Better yet, just use a button, and use CSS to style so it looks like a
link. Other than the presentation, I can't imagine any reason for using
a link instead of a real button.

--
Lachlan Hunt
http://www.lachy.id.au/

Please direct all spam to ab***@127.0.0.1
Thank you.
Jul 20 '05 #5

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

Similar topics

1
2732
by: Eric | last post by:
Hello everyone, I am pretty much newbie to ASP so please bear with me as I explain my problem. I currently have a main form which displays data queried from a SQL database. From that main page I have a hyperlink which opens a child window and allows edits to the data displayed on the parent form. As the child form is submitted, it is...
2
5321
by: Alexander Ross | last post by:
I know that <a href="javascript:document.formname.submit();"> works for this, but can you use a hyperlink to submit a form WITHOUT assigning the form tags name attribute a value. The site I am currently working on is supposed to be HTML 4 (w3c) complient, but according to the HTML validator the name attribute has been depreciated and should no...
3
2593
by: Arun K | last post by:
Hi, I am creating a simple .aspx page to add some fields with validation. I have used different .NET validations like REquiredFieldValidator, RegularExpressionValidator and showed the summary in the bulleted list on top. I have 3 text boxes, and two RadioButtonList. and 3 buttons. One for Submit, Reset and Exit. If submit is pressed...
1
2563
by: kkuniya | last post by:
Situation : - A form (method : POST, action : itself, onsubmit : alert 'Submit' ) - Got 2 submit button ( 'Save' , 'View') - Got navigation 1|2|3|4 What I want to do : - Once clicked on the navigation page, it will save the page without need to click on 'Save' button. Currently, if i manually clicked on the 'Save' button; it will save the...
2
3431
by: Mike Baugh | last post by:
I am using visual studio 2005 to develop a form using c# I have 3 datagrids on one form. I can set the row color based on a certain value in a column. However this color applies to all 3 datagrida. I would like to set it so that if value of column 3 in datagrid 1 is < 100 set to red, if = 100 set to green if value of column 3 in...
2
2142
by: b3t1m0s | last post by:
Hi everyone here! I have a special case and I want to ask can I realize this in JavaScript/AJAX. The case is: I have html submit form that should send data to php file. When submit button is pressed a "popup" or modal windows must be displayed and user must click in page (ex. image), and page should open a new window (from image hyperlink ex.)...
5
7411
AnuSumesh
by: AnuSumesh | last post by:
hi I want to submit the form and click the link on body load event. i m using the following code: <script> Function clicklinl() { document.getElementById("back").click(); }
3
1358
by: Slpixe | last post by:
Hey there, I'm wondering if it is possible to have,,,,,or trick html into letting me use a hyperlink as a submit, so that I can keep with my css text buttons, The reason I see this as possible is php statmentments like echo "(If your browser doesn't support this, <a href=\"" . $_POST. "\">click here</a>)";
11
5277
by: V S Rawat | last post by:
using Javascript, I am opening a web-based url in a popup window. MyWin1=Window.Open(url, "mywindow") There is a form (form1) in the url in that popup window, I need to submit that form. How do I submit that form1 from the javascript from my current window? Thanks.
0
7693
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...
0
7917
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. ...
0
8118
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...
1
5501
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...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2105
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
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
933
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.