473,238 Members | 1,845 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,238 software developers and data experts.

Setting CGI parameter programmatically



I have a form with a couple of submit buttons, plus a "pseudolink"
that is also supposed to submit the form; the submitted form data
feeds to a CGI script. The two submit buttons have the name
"go_for_it", so that when the form is submitted, the CGI script
looks for the value of the CGI parameter "go_for_it". I want the
pseudolink to set the value of this CGI parameter prior to submitting
the form, but I can't get it to work. Here's the latest version
of the HTML+JavaScript code for the pseudolink:

<a onclick="var f = document.forms['myform']; f['go_for_it'][0].value='foo'; f.submit(); return false;" href="warn_no_js.html">pseudolink</a>

After one clicks on the pseudolink, the receiving CGI reports that
the CGI parameter "go_for_it" is not defined. What am I doing
wrong?

Thanks!

jill

--
To s&e^n]d me m~a}i]l r%e*m?o\v[e bit from my a|d)d:r{e:s]s.

Jul 23 '05 #1
2 2196
J Krugman wrote:


I have a form with a couple of submit buttons, plus a "pseudolink"
that is also supposed to submit the form; the submitted form data
feeds to a CGI script. The two submit buttons have the name
"go_for_it", so that when the form is submitted, the CGI script
looks for the value of the CGI parameter "go_for_it". I want the
pseudolink to set the value of this CGI parameter prior to submitting
the form, but I can't get it to work. Here's the latest version
of the HTML+JavaScript code for the pseudolink:

<a onclick="var f = document.forms['myform'];
f['go_for_it'][0].value='foo'; f.submit(); return false;"
href="warn_no_js.html">pseudolink</a>

After one clicks on the pseudolink, the receiving CGI reports that
the CGI parameter "go_for_it" is not defined. What am I doing
wrong?

Thanks!

jill


Hi Jill,

Did you create a formvariable (possibly hidden) that goes by the name
go_for_it ??

And why do you use f['go_for_it'][0].value='foo' instead of
f['go_for_it'].value='foo' ???

Regards,
Erwin Moller
Jul 23 '05 #2

In <41***********************@news.xs4all.nl> Erwin Moller <si******************************************@spam yourself.com> writes:
J Krugman wrote:
I have a form with a couple of submit buttons, plus a "pseudolink"
that is also supposed to submit the form; the submitted form data
feeds to a CGI script. The two submit buttons have the name
"go_for_it", so that when the form is submitted, the CGI script
looks for the value of the CGI parameter "go_for_it". I want the
pseudolink to set the value of this CGI parameter prior to submitting
the form, but I can't get it to work. Here's the latest version
of the HTML+JavaScript code for the pseudolink:

<a onclick="var f = document.forms['myform'];
f['go_for_it'][0].value='foo'; f.submit(); return false;"
href="warn_no_js.html">pseudolink</a>

After one clicks on the pseudolink, the receiving CGI reports that
the CGI parameter "go_for_it" is not defined. What am I doing
wrong?

Hi Jill, Did you create a formvariable (possibly hidden) that goes by the name
go_for_it ??
I'm not sure what you mean by a form variable. There are two submit
buttons each of which has "go_for_it" as its name attribute, but
they have different value attributes (say "foo" and "bar"). When
the form is submitted by clicking on one of these submit buttons,
the CGI at the server end receives the value attribute of the
clicked submit button as the value of the CGI parameter "go_for_it".

What I want to do is to be able to set that same CGI parameter and
submit the form when the user clicks on the pseudolink mentioned
above.
And why do you use f['go_for_it'][0].value='foo' instead of
f['go_for_it'].value='foo' ???


Because when I inserted the statement

alert(f['go_for_it'])

I learned that f['go_for_it'] is not an input element but rather
a NodeList object; if I replace this alert statement with

for (var i = 0; i < f['go_for_it'].length; ++i) {
alert(f['go_for_it'][i]);
alert(f['go_for_it'][i].name);
alert(f['go_for_it'][i].value);
}

I get the following results:

object HTMLInputElement
go_for_it
foo
object HTMLInputElement
go_for_it
bar

I now realize that setting f['go_for_it'][0].value can't be the
way to set the value of the CGI parameter, because that value is
already set even before one clicks on the submit button...

Bottom line: what I need to find out is what field of the form or the
appropriate input element I must set to the desired value so that the
receiving CGI script can read it as the value of the "go_for_it" CGI
parameter.

TIA

jill

--
To s&e^n]d me m~a}i]l r%e*m?o\v[e bit from my a|d)d:r{e:s]s.

Jul 23 '05 #3

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

Similar topics

8
by: dave | last post by:
I am sending an email from an asp.net application. I have set the from address a b@b.com but would like the name of this user to show up as Big Bob. How can i tell .net email object that when...
18
by: Dixie | last post by:
Can I set the Format property in a date/time field in code? Can I set the Input Mask in a date/time field in code? Can I set the Format of a Yes/No field to Checkbox in code? I am working on...
2
by: Buddy Robbins | last post by:
Hey folks, I am in desparate need of help to solve my problem. I have written a service that examines a table in a database, and creates a directory hierarchy based on data in the table. It...
1
by: Loading name... | last post by:
Hey asp.net 2.0 I have a GridView on my webpage. The datasource behind this GridView needs 1 parameter. This parameter is afaik only available from the code (the parameter is the...
2
by: Charlie | last post by:
Hi: I'm using the ObjectDataSource control to databind a Repeater. The method on business object that ObjectDataSource control point to takes as a parameter an instance of the...
6
by: =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?= | last post by:
I am wondering how to programmatically select either SqlServer or Windows authentication when connecting to a database. Is this something in the connection string? Or is it some other parameter to...
2
by: JJ | last post by:
How can I set an ObjectDataSource's Parameter programmatically? The slight complication here is that I want to set this NOT in the 'Selecting' method of the ObjectDataSource, but elsewhere. I...
0
by: RKT | last post by:
I have a DataGridView bound to an MS Access table. This is a single- user application. When the User is adding or editing a row, the User may click on a Control elsewhere. That Control has context...
2
by: Ronald S. Cook | last post by:
In my solution, I have a client (Windows app) and a class library. The class library project has a connection string setting that I would like to be able to change (from the client project...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.