473,662 Members | 2,666 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1953
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="javascrip t: submitform()">S earch</A>
</form>
<SCRIPT language="JavaS cript">
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(form ID)
{
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="javascrip t:
submitform()">S earch</A> </form>
<SCRIPT language="JavaS cript">
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(form ID)
{
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(form ID)
{
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.getEl ementById && (form =
document.getEle mentById(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
2349
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 but the resulting HTML isn't working right. It consists of multiple forms on a page with each form using a unique name. The submit button in each form also uses a unique name. The forms are supposed to submit a single value from a hidden field...
8
17298
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 change this field is some of the forms have two buttons on them, each needs to process the form differently. If I can change the value of the hidden field dynamically it will solve my issue as I can run each against a diffent cgi. Currently my...
2
17178
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 "release_or_not". of course in the server side I validate those values as well. However, because this page is for admin to use so that I do not need to care any hacker action. Hence, in the client side javascript I validate those values and give it a popup...
2
2084
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 many data in the form? Any workarounds? <a href="http://myserver/index.jsp?name=test&actionType=test" target="_blank">Add New Document</a> Please advise. thanks!!
8
2081
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" action="login.php"> <input type="hidden" name="LogType" value="ManageProfile"> </form><script language="javascript">document.forms.submit();</script>
4
2683
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 href="javascript:document.MyForm.submit();" For whatever reason, I cannot get the following page to submit -- I have been looking at this so long I cannot see it - though I know it;s somethign simple and looking right at me! Can anyone please give this a cursory glance and point out...
8
3351
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 about in the submitted action. I'd therefore like to get rid of them by doing something like:
1
10930
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 called, but no form variables are passed to the page. Here's the client-side code: //Create or reuse an IFRAME to submit data to a specified page. //commandToken: A string that tells the page what to do. //data: Data that the page will work...
0
8345
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
8857
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8768
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...
0
8633
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
7368
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6186
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5655
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
4181
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...
2
1999
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.