/    Sign up×
Community /Pin to ProfileBookmark

Form Input-CLICK Simulation

Hi!
I’ve got a page:

[CODE]
<html><body>
<form action=”example.html” method=”post” name=”myform”>

<input type=”text” name=”mytext” value=””>
<input type=”image” name=”NameWith/And.IsHere” src=”submit.gif”>

</form>

<script language=”JavaScript”>
function disableForm(theform) {
for (i = 0; i < theform.length; i++) {
var tempobj = theform.elements[i];
if (tempobj.type.toLowerCase() == “image”)
//doesn’t work
tempobj.click();
}
}
}

disableForm(myform);
</script></body></html>
[/CODE]

My problem is that I like to simulate a CLICK on the image. That’s important because the image has a name which is need on the target page. Don’t ask why ^^
That’s why myform.submit() wouldn’t work.

Please help my. thx

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@Phil_KarrasAug 11.2003 — You do not need to "simulate" a click on the image, when the submit button is

clicked it sends the form to example.html, if you want an image name to

go along simply put it in a hidden input:

<input type='hidden' name='ImagName' value='ThisImage.jpg'>

Or somehting like that & then in [b]example.html,[/b] you pick up that name & use it.

There is an article on how to get this kind of data from the URL on the

http://www.jsworkshop.com/ site, called [b][color=blue]Hint: Passing Data[/color][/b] I believe.

But you probably know how to do that already. Hope that helps.
Copy linkTweet thisAlerts:
@ProfEichauthorAug 12.2003 — well, the problem is that the target page controls if the name of the submit-image exists. If you click on the image the submit-image-name will be send with. with form.submit() it won't.
Copy linkTweet thisAlerts:
@Phil_KarrasAug 12.2003 — If you do as I said it will.
×

Success!

Help @ProfEich spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...