473,545 Members | 2,011 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 4183
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
20901
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
2172
by: Dodo | last post by:
Is it possible to create a link that can post a value to an ASP page without java?
2
3182
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...
18
1700
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
19109
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...
24
2860
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
11689
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" />...
23
14469
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...
1
1689
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...
0
7411
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...
0
7926
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
7439
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...
0
7773
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...
0
5987
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5343
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...
1
1901
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
1028
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
722
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.