Stupid problem with this.form.submit()

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
jmut
Forum Regular
Posts: 945
Joined: Tue Jul 05, 2005 3:54 am
Location: Sofia, Bulgaria
Contact:

Stupid problem with this.form.submit()

Post by jmut »

hi,
Using FF 1.06
I have the following code...

Code: Select all

<form name="myform" action="" method="post">
  <select id="navigaiton_menu" name="navigation_type" onchange="this.form.submit();">
    <option label="Booking Conditions" value="Booking Conditions" selected="selected">Booking Conditions</option>
    <option label="Cancelation Policy" value="Cancelation Policy">Cancelation Policy</option>
    
    <option label="FAQ" value="FAQ">FAQ</option>
    <option label="BG Guide" value="BG Guide">BG Guide</option>
    <option label="BG Intro" value="BG Intro">BG Intro</option>
    <option label="Travel Tips" value="Travel Tips">Travel Tips</option>
    <option label="About Us" value="About Us">About Us</option>
    <option label="Terms and Conditions" value="Terms and Conditions">Terms and Conditions</option>
    </select>
</form>
Can someone explain to me why this is not working all the time? What it depends on.
So if I separate this code it works like a charm....when I integrate it in a file with other forms etc....it is not working.
I checked for duplicated names,ids but couldn't find one
I sometimes get this error on Javascript Console
Error: this.form.submit is not a function

I am a bit new to JS thats why I address the forum for help
Thanks in adavnce.
User avatar
n00b Saibot
DevNet Resident
Posts: 1452
Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:

Post by n00b Saibot »

maybe try :arrow: document.myform.submit()
jmut
Forum Regular
Posts: 945
Joined: Tue Jul 05, 2005 3:54 am
Location: Sofia, Bulgaria
Contact:

Post by jmut »

n00b Saibot wrote:maybe try :arrow: document.myform.submit()
no success :(
And shouldn't this.form.submit() work always.
Why trying with different approach.
Is there known flaw in the browser concerning this?
User avatar
n00b Saibot
DevNet Resident
Posts: 1452
Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:

Post by n00b Saibot »

jmut wrote:
n00b Saibot wrote:maybe try :arrow: document.myform.submit()
no success :(
And shouldn't this.form.submit() work always.
Why trying with different approach.
Is there known flaw in the browser concerning this?
Ya, what you say is true, but the prob is this that js implementation in terms of DOM and event-handling is different on different browsers. Thats why writing cross-browser compliant scripts is a real PITA. The scripts that run beautifully on one turns up nasty in another browser...
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

it may be whining about the empty action attribute...
jmut
Forum Regular
Posts: 945
Joined: Tue Jul 05, 2005 3:54 am
Location: Sofia, Bulgaria
Contact:

Post by jmut »

well, I already added a submit button :(
Its not the empty action attribute that caused the problem.
Thanks for help. I was thinking I missed something fundamental here thats why I posted.
Will investigate the problem when got time.
10x again.
Post Reply