473,386 Members | 1,706 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,386 software developers and data experts.

How to submit dynamically generated hidden forms

P
Hi,

As the subject says, I would like to submit dynamically generated
hidden forms with javascript. I'm fairly new to javascript. I've
googled around but couldn't find a solution. I would appreciate if
someone can point me to the right direction.

Thanks

Aug 9 '05 #1
6 1945
On Tue, 09 Aug 2005 08:50:59 -0700, P wrote:
Hi,

As the subject says, I would like to submit dynamically generated
hidden forms with javascript. I'm fairly new to javascript. I've
googled around but couldn't find a solution. I would appreciate if
someone can point me to the right direction.

Thanks


submit() function.

http://www.javascript-coder.com/java...m-submit.phtml

--
"Blessed is he who expects nothing, for he shall never be disappointed."
Benjamin Franklin (I didn't know he was a Buddhist)

Aug 9 '05 #2
P
On the site you've provided, it gave this example:

<form name="myform" action="handle-data.php">
Search: <input type='text' name='query'>
<A href="javascript: submitform()">Search</A>
</form>
<SCRIPT language="JavaScript">
function submitform()
{
document.myform.submit();
}
</SCRIPT>

What I'm hoping to do is to have a function like that, but takes an
argument for the name of the form. This is probably the wrong syntax
but I think it shows what I want to do:

function submitform(formID)
{
document.formID.submit();
}

Aug 9 '05 #3
On Tue, 09 Aug 2005 10:16:08 -0700, P wrote:
On the site you've provided, it gave this example:

<form name="myform" action="handle-data.php">
Search: <input type='text' name='query'> <A href="javascript:
submitform()">Search</A> </form>
<SCRIPT language="JavaScript">
function submitform()
{
document.myform.submit();
}
</SCRIPT>

What I'm hoping to do is to have a function like that, but takes an
argument for the name of the form. This is probably the wrong syntax
but I think it shows what I want to do:

function submitform(formID)
{
document.formID.submit();
}


IIRC the form name isn't a valid object in any browser.

I think the submit function has to be called in the body of the form...
but I may be wrong about that.

--
"Blessed is he who expects nothing, for he shall never be disappointed."
Benjamin Franklin (I didn't know he was a Buddhist)

Aug 9 '05 #4
P
Yes, you are correct. The function I wrote is not valid. But is it
possible to do something similar?

Aug 9 '05 #5


P wrote:

function submitform(formID)
{
document.formID.submit();

If the form has an id attribute and you pass its value in as the formID
parameter then you can use
var form;
if (document.getElementById && (form =
document.getElementById(formID))) {
form.submit();
}

--

Martin Honnen
http://JavaScript.FAQTs.com/
Aug 9 '05 #6
P
aaaah, I see. Thanks Martin :)

Aug 9 '05 #7

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

Similar topics

2
by: Phillip Windell | last post by:
This is really an HTML question I think, but it probably won't take much effort to answer (unless I'm answering or course). The HTML is all ASP generated and the ASP generates exactly what I want...
8
by: Matt Herson | last post by:
I have been trying to find a way to use JavaScript to change the value of a hidden field on submit. I am already invoking a JavaScript to handle the validation on submit. The reason I need to...
2
by: sandyde2 | last post by:
Hi all, I get the tough problem and expect to get help.. In a html page, I dynamically created many forms which named as NO+business_id. In each form there are two submit buttons to...
2
by: Matt | last post by:
Can we click a link and it will submit the form to the other page? Usually we will submit the form to other page by clicking a submit button. Now I need to do the following, but what if I have...
8
by: Bob Bedford | last post by:
I've a code with redirect to a login page if nobody is registered. It works fine on IE6, but I'm trying with NS, and it doesn't work. Here is the code: <form name="RedirectLogin" method="POST"...
4
by: Ike | last post by:
Oh I must be missing somethign so simple and stupid. I need to do a submit() via an href, which I do (succesfully) in JavaScript in many other pages with <a...
8
by: horos | last post by:
hey all, Ok, a related question to my previous one on data dumpers for postscript. In the process of putting a form together, I'm using a lot of placeholder variables that I really don't care...
1
by: gzannd | last post by:
I have a problem with submitting a form to a PHP page through a dynamically created IFRAME in IE7. This code works fine in Firefox. However, IE7 submits an empty form--the correct PHP page is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
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
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.