/    Sign up×
Community /Pin to ProfileBookmark

how to solve the .click() problem

I’m making a form,with a file input,and the input should be hidden,so the action of click is done by another button.

I found that I can submit the form after directly clicked the file input,
but it didn’t work using the indirect button. ? ?

Can anybody solve this problem?
Thank you!

CODE as follows:

[CODE]<HTML>
<HEAD>
<TITLE>javascript</TITLE>
<SCRIPT LANGUAGE=javascript>
function checkit(args)
{
if(args.sendText.value==”)
{
alert(“no file selected”); return false;
}
else return true;
}

</SCRIPT>
</HEAD>
<BODY bgcolor=”#FFFFFF” >

<form name=form action=1.html>

<input type=”file” name=”sendText” onclick=”click();”>
<input type=”submit” name=”submit” onclick=”return checkit(this.form);” value=”submit the form directly”><br><br>
<input type=”button” name=”check” onclick=”document.form.sendText.click();” value=”open the browse file dialogue indirectly”>
<input type=”button” name=”check2″ onclick=”document.form.submit.click();” value=”submit the form indirectly”>

</form>
<pre>
result:
1.if click the “browse…” button,both direct and indirect submit work well,
2.once the “open the browse file dialogue indirectly” was clicked, no way to submit the post,</pre>
</BODY>
</HTML>
CODE]

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@LuciferStarauthorAug 01.2005 — http://free4.e-168.cn/singlestudio/hotpot/frame/

I've found the way out,but not the best.

Please come and talk about it!
×

Success!

Help @LuciferStar 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 5.18,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...