473,770 Members | 1,644 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Post via hidden input types & javascript won't work...

Hi,

I don't see why this won't work,
it are 3 links, the last one (a get) does work, but the first 2 won't.
i would like to use a post, through hidden input types
any idea?
thanks for your help!
bjorn

<HTML>
<HEAD>
<TITLE>testing. ..</TITLE>
<script language="Javas cript">

function fAction(Machine ID5, ImageFile5)
{
theForm.Machine ID.value = MachineID5;
theForm.ImageFi le.value = ImageFile5;
theForm.submit( ));
}
</script>
</HEAD>
<BODY bgcolor="#98D0F 8">
<form action="bbb.php " name="theForm" id="theForm" method="post"
TARGET="right">
<input type="hidden" id="MachineID" name="MachineID ">
<input type="hidden" id="ImageFile" name="ImageFile ">

<A href="javascrip t:fAction('1',' AAA.jpg');">Lin k to AAA</A><br>

<A href="#" onClick="javasc ript:fAction(6, 'image/BBB.jpg');">Lin k to
BBB</A><br>

<A href="bbb.php?M achineID=13&Ima geFile='image.j pg'" TARGET="right"> Link
test</A><br>

</form>

</BODY>
</HTML>
Jan 13 '06 #1
6 4205
b. hotting wrote:
I don't see why this won't work,
it are 3 links, the last one (a get) does work, but the first 2 won't.
i would like to use a post, through hidden input types
any idea?

[...]
<script language="Javas cript">
function fAction(Machine ID5, ImageFile5)
{
theForm.Machine ID.value = MachineID5;
theForm.ImageFi le.value = ImageFile5;
theForm.submit( ));
}
</script>
[...]


theForm.submit( ));

should be

theForm.submit( );

(syntax error, two brackets)

Hope this helps,

--
Bart

Jan 13 '06 #2
still doesn't work ;-((

hoped that would do it but it seems its not the only error ;-)

"Bart Van der Donck" <ba**@nijlen.co m> wrote in message
news:11******** **************@ g49g2000cwa.goo glegroups.com.. .
b. hotting wrote:
I don't see why this won't work,
it are 3 links, the last one (a get) does work, but the first 2 won't.
i would like to use a post, through hidden input types
any idea?

[...]
<script language="Javas cript">
function fAction(Machine ID5, ImageFile5)
{
theForm.Machine ID.value = MachineID5;
theForm.ImageFi le.value = ImageFile5;
theForm.submit( ));
}
</script>
[...]


theForm.submit( ));

should be

theForm.submit( );

(syntax error, two brackets)

Hope this helps,

--
Bart

Jan 13 '06 #3

b. hotting wrote:
<script language="Javas cript">
The language attribute is deprecated use the type attribute instead:

<script type = "text/javascript">
theForm.Machine ID.value = MachineID5;
theForm.ImageFi le.value = ImageFile5;
Just a matter of personal preference, I like to use the square bracket
notation:

document.forms["theForm"].elements["MachineID"].value = MachineID5;
document.forms["theForm"].elements["ImageFile"].value = ImageFile5;
theForm.submit( ));
You have an extra closing parenthesis. You could also try:

document.form["theForm"].submit();

<A href="javascrip t:fAction('1',' AAA.jpg');">Lin k to AAA</A>
The use of pseudo javascript protocol is highly frowned upon. Try at
least using the onclick event handler:

<a href = "#" onclick = "fAction('1 ', 'AAA.jpg');">Li nk to AAA</a>
<A href="#" onClick="javasc ript:fAction(6, 'image/BBB.jpg');">Lin k to BBB</A>
The pseudo javascript protocol has no place in the event handler,
remove it:

<a href = "#" onclick = "fAction(6, 'image/BBB.jpg');">Lin k to BBB</a>

In the above two links, you'll most likely want to return false so that
link won't get followed. You should also note, for a graceful
degradation, you should provide an actual link, in case the user has
javascript disabled.
<A href="bbb.php?M achineID=13&Ima geFile='image.j pg'" TARGET="right"> Link
test</A><br>


It seems to me that this link doesn't even need to be within the form,
since you're not submitting the form with this anyway.

Jan 13 '06 #4
web.dev wrote:
b. hotting wrote:
theForm.Machine ID.value = MachineID5;
theForm.ImageFi le.value = ImageFile5;


Just a matter of personal preference, I like to use the square bracket
notation:

document.forms["theForm"].elements["MachineID"].value = MachineID5;
document.forms["theForm"].elements["ImageFile"].value = ImageFile5;


It is not only a matter of personal preference. The latter (yours) is
the standards compliant approach, the former is the proprietary one.
theForm.submit( ));


You have an extra closing parenthesis. You could also try:

document.form["theForm"].submit();


document.form_s _, as above.
PointedEars
Jan 13 '06 #5
Ran into the same problem a while back, tried a few combinations and
finally got it to work on IE and firefox. Check out:

http://www.suckingfish.com/view.do?crumb_id=dsid_1104

Good luck,

Matt

Jan 13 '06 #6
Thanks guys!
Really appreciated!

Jan 14 '06 #7

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

Similar topics

7
20931
by: Rui Pestana | last post by:
Hello all, I want to use the POST method to submit the form and then grab the parameters in the asp file with request.form("parm"). The problem is that I am using the _search target to open the asp page. When I use _blank target there is no problem, either I use GET or POST method. But when I use _search target, only GET method works.
4
2190
by: Dodo | last post by:
Is it possible to create a link that can post a value to an ASP page without java?
2
3191
by: cschang | last post by:
I have a page created by using response.write. I just found out that if I put a <input type=hidden..> within a <div> section, this <input ..> could not be referenced in the javascript. Becasue when I used the document.form1.tageName.value, the system will respond as an undefined. However, If I put this <input type=hidden..> outside the <div>, then it is OK. The basic structure of the page is like <form ....name=form1 > <input ......
18
1715
by: q2005 | last post by:
Hi, all When I do as the following, it becomes a GET action to the the server. How do I make it as a POST action? That means I don't want the string after "?" show on URL bar and, to the server, it can follow POST function to get the data passed in. Thank you very much! window.open("../../Server.php?"+xsValue, "", zNONHTML_STYLE);
3
19131
by: kaushalmbhavsar | last post by:
I am working on one VB.NET application where I am using WinHttp.dll to post request on website. First request is for Login Page and I have gone through all input types of that page and pass those variables and value pair in Send method of WinHTTPRequest but it is not works. Let' me inform you that this login page has viewstate hidden input type, so should I have to pass it in post string (String for Send method argument) list of Input...
24
2884
by: moriman | last post by:
Hi, The script below *used* to work. I have only just set up a server, PHP etc again on my Win98 system and now it doesn't? On first loading this page, you would have $p = and the button image below it.
4
11718
by: WB | last post by:
Hi, I need to validate a hidden input in my webform to ensure that it's got value. The controls look something like this: <input id="HidSelectedStates" type="hidden" runat="server" /><br /><br /> <asp:Button ID="BtnSubmit" runat="server" OnClick="BtnSubmit_Click" Text="Submit" ValidationGroup="submitStates" /> <asp:RequiredFieldValidator ID="RequiredFieldValidator1"
23
14521
by: Bjorn | last post by:
Hi. Every time i post data in a form the contents are being checked for validity. When i click the back-button, all data is gone and i have to retype it. It's obvious that only a few or none of the visitors will retype it all so i'm asking: "how to preserve POST-data when clicking the back-button?" i've already tried to print post data as a value in a HTML tag but
1
1702
by: Sideswipe | last post by:
I am trying to concatenate selected values from numerous radio button sets into 1 series and assign it to a single hidden field. I have never done javascript before and I continue to run into problem after problem (object has no properties, undefined functions, etc.) So, I am really hoping someone can end the madness for me. Just so it's understood, the id's and names of the radio buttons vary with a row in a table so I CANT know the...
0
9595
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
9432
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10059
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
10008
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
9873
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...
0
6682
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();...
0
5313
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5454
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3578
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.