/    Sign up×
Community /Pin to ProfileBookmark

Javascript submit() won’t submit

I have used this same code elsewhere and it worked as expected. I must be overlooking a semicolon or something, any ideas?

<html>
<head>
    <title>FAMembers.Net - TV Spots for Test</title>
    <script type="text/javascript">
        function VideoTrackNLog(videoname, filename){
            frmVideoTrackNLog.videoname.value = videoname;
            frmVideoTrackNLog.nextpagename.value = filename;
            frmVideoTrackNLog.submit();
        }    
</script> </head> <body> <p><b>View New TV Spots for Testing</b></p> <p> <a href="mms://streaming.ccaglobal.com/flooringamerica/January_Free_TV_Promotion.wmv" onclick="VideoTrackNLog('Best Practices 5','streaming.ccaglobal.com/flooringamerica/January_Free_TV_Promotion.wmv');">January Free TV Promotion</a><br/> </p> <form id="frmVideoTrackNLog" name="frmVideoTrackNLog" action="/FAMediaTracker.asp" method="post"> <input type="hidden" name="videoname" value="default" /> <input type="hidden" name="nextpagename" value="default" /> </form> </body> </html>
to post a comment
JavaScript

14 Comments(s)

Copy linkTweet thisAlerts:
@yamaharussFeb 19.2011 — try document.frmVideoTrackNLog.submit();
Copy linkTweet thisAlerts:
@jmansonauthorFeb 21.2011 — Thanks Yamaharuss! But still a no go. Still goes to the anchor tag and fires the javascript but does not submit to next page.
Copy linkTweet thisAlerts:
@WolfShadeFeb 21.2011 — Thought I had something. I don't.

^_^
Copy linkTweet thisAlerts:
@jmansonauthorFeb 21.2011 — Thanks for the thought!
Copy linkTweet thisAlerts:
@WolfShadeFeb 21.2011 — <a href="mms://streaming.ccaglobal.com/flooringamerica/January_Free_TV_Promotion.wmv" onclick="VideoTrackNLog('Best Practices 5',[color=red]this.href[/color]);">January Free TV Promotion</a><br/>
Copy linkTweet thisAlerts:
@jmansonauthorFeb 21.2011 — Hey WolfShade. Not sure that helps. If it does help I'm not sure why it would help as the second parameter could be any value. The submit is supposed to submit to /FAMediaTracker.asp. the value in the second parameter is a filename that will be stored in a tracking database and should be inserted into the form frmVideoTrackNLog and submited to the next page where it should update the databse and then return.
Copy linkTweet thisAlerts:
@aj_nscFeb 21.2011 — I'm not even sure why the rest of the code works, but it does so whatever I guess. You need to submit the actual form element.


<i>
</i>document.getElementById('frmVideoTrackNLog').submit();
Copy linkTweet thisAlerts:
@jmansonauthorFeb 21.2011 — aj_nsc thanks for the idea. That doesn't submit the form either. I have tried many different ways to address the form, like document.forms[0].submit() and document.forms['frmVideoTrackNLog'].submit() and the like. It seem that there is something wrong with the form. Where I use this code elsewhere it works fine. If I code onclick="frmVideoTrackNLog.submit();alert();" the submit doesn't happen but the alert does.
Copy linkTweet thisAlerts:
@jmansonauthorFeb 21.2011 — BTW a button with onclick="frmVideoTrackNLog.submit();" within the form will submit it
Copy linkTweet thisAlerts:
@WolfShadeFeb 21.2011 — When it's not working, it _should_ give you a JavaScript error. Did you look to see what the error is/was?

^_^
Copy linkTweet thisAlerts:
@jmansonauthorFeb 21.2011 — No error, the submit just doesn't happen
Copy linkTweet thisAlerts:
@WolfShadeFeb 21.2011 — In which browser are you testing? IE should give you a yellow triangle with a black exclamation mark, down lower left corner of browser; double click it to see the error message. FF doesn't do much unless either A) FireBug is installed and active, or 2) you open the Error Console window. If it's not submitting AND not giving an error message, then the submit isn't even being called; the event is not triggering.

^_^
Copy linkTweet thisAlerts:
@jmansonauthorFeb 21.2011 — I am testing ith IE 8 and the developer tools, FireFox 3.6 and Firebug, Google Chrome 9, Opera 11 and Safari 4 which BTW it works in Safari. Go figure.
Copy linkTweet thisAlerts:
@WolfShadeFeb 21.2011 — If neither IE or FF are giving an error message, then either the function works and does absolutely nothing (unlikely), or the page is being reset before the error message can be displayed. Still, even in that situation FF's Error Console will keep a record of it, and FireBug will notice it, too.

IDK.

^_^
×

Success!

Help @jmanson 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.25,
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,
)...