/    Sign up×
Community /Pin to ProfileBookmark

document.myform.submit() not working

I have a form and a button that calls this script (I know you can use a submit button but I’m testing it because I couldn’t get it to work from a larger script) and I get the error – Object doesn’t support this object or method. What am I doing wrong??

[CODE]
<script>
function subit()
{
document.upsfm.submit();
}
</script>
</HEAD>
<BODY>
<CENTER>
<FORM method=”post” action = “http://wwwapps.ups.com/WebTracking/OnlineTool” target=”main” name=”upsfm”>
<INPUT type=”text” size=20 name=”InquiryNumber1″>&nbsp;,&nbsp;&nbsp;
<INPUT type=”text” size=20 name=”InquiryNumber2″>&nbsp;,&nbsp;&nbsp;
<INPUT type=”text” size=20 name=”InquiryNumber3″>
<INPUT type=”button” value=”Submit Test” onClick=”subit();”>
<INPUT type=”submit” value=”Go!”>
</form>
[/CODE]

to post a comment
JavaScript

6 Comments(s)

Copy linkTweet thisAlerts:
@CharlesSep 06.2004 — [i]Originally posted by IxxI [/i]

[B]What am I doing wrong??[/B][/QUOTE]
1) The SCRIPT element requires a "type" attribute.

2) Thew FORM element cannot directly contain inline elements.

3) The CENTER element was long ago depricated.

4) You are trying to make a JavaScript dependent page. Bad, very bad.
Copy linkTweet thisAlerts:
@KorSep 06.2004 — There is no reason for not working. Check your CGI, maybe something went wrong between your two testes.
Copy linkTweet thisAlerts:
@IxxIauthorSep 06.2004 — [i]Originally posted by Charles [/i]

[B]1) The SCRIPT element requires a "type" attribute.



2) Thew FORM element cannot directly contain inline elements.



3) The CENTER element was long ago depricated.



4) You are trying to make a JavaScript dependent page. Bad, very bad. [/B]
[/QUOTE]


1.) I'm just messing about on my computer - the script element has always seemed to assume javascript on my computer before.

2.)Which inline elements? Sorry I've never worked out what is and is not inline.

3.) Again, I'm just messing about on my computer, center works and that wouldn't mess up the script. If I were putting this on the web I would use css, and this is a page written long ago which I've come back to.

4.)If you note the <INPUT type="submit" value="Go!"> you will see that the page is not javascript dependant. And whether it is or is not does not affect whether the script works or not.

IxxI
Copy linkTweet thisAlerts:
@IxxIauthorSep 06.2004 — [i]Originally posted by Kor [/i]

[B]There is no reason for not working. Check your CGI, maybe something went wrong between your two testes. [/B][/QUOTE]


As far as I can ascertain my testes are fine ? .

The CGI isn't mine its on a website - its the javacript thats not working as that gives an error caught by the script debugger - but you're right it should work...I'll check again. It works when using the normal submit so the form action is fine, however I still get the object doesn't support this property or method error when I use the javascript.

IxxI
Copy linkTweet thisAlerts:
@IxxIauthorSep 06.2004 — Found it - turns out what I thought was a line-wrap in my editor was actually a return :rolleyes: . Sorry people.

IxxI
Copy linkTweet thisAlerts:
@KorSep 06.2004 — eeer... have you check whether your browser is javascript disabled or not? From this point of view Charles might be right. There is no reason to use a javascript method if there is a classic HTML equivalent one...
×

Success!

Help @IxxI 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.16,
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,
)...