-
July 30th, 2002, 10:29 AM
#1
Javascript Question
Hi all,
I'm working on ASP pages and I need some javascript to be done. I was thinking you might help me out with this :
here's the problem
I dynamically add forms to my html page ( search results ) and I need to send the form when the user clicks on the link of the form.
here's the code I've been working around so far
Code:
function FormSubmit(FormToSend)
{
var Str;
Str = "Document."+FormToSend;
SendingForm = eval(Str);
SendingForm.submit();
}
I'm using a counter for the form name. and send it to the FormSubmit Function. Well as you can expect the eval line doesn't work. it says it expects a ";" and none is missing. Is there a way to get a reference to an object dynamically ?..
Nicolas Bohemier
-
July 30th, 2002, 10:39 AM
#2
try this...
From where are you calling the FormSubmit function?
Depending on this, you could use
onclick="javascript:FormSubmit();" and examine the window.event.srcElement to determine the object which was clicked.
-
July 30th, 2002, 11:28 PM
#3
The only problem with this function is "Document"
in this expression
Str = "Document."+FormToSend;
try this and it will work:
Str = "document."+FormToSend;
(note that small 'd' in 'document' here)
Now the function will be:
function FormSubmit(FormToSend)
{
var Str;
Str = "document."+FormToSend;
SendingForm = eval(Str);
SendingForm.submit();
}
Anupam.
-
July 31st, 2002, 10:41 AM
#4
I found a solution and it's even simpler
function formSubmit(FormToSend)
{
document.all(FormToSend).submit();
}
Nicolas Bohemier
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|