473,385 Members | 1,973 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,385 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 2204
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...

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.