Forum Moderators: open

Message Too Old, No Replies

action attribute in netscape

form action no page reload valid html

         

huds

3:21 pm on Sep 25, 2006 (gmt 0)

10+ Year Member



I have a webpage with an html form and some javascript to manipulate the elements. It works fine in ie and opera, but not netscape.

The problem seems to be the action attribute on the form, it somehow stops netscape in it's tracks and it doesn't process my js functions.

If I remove the action attribute altogether then it works fine in all of them, but then it's not valid html.

Can anyone help please?

penders

6:17 pm on Sep 25, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hhhmmm, I think you need to post some code for us to have a look...

huds

8:52 pm on Sep 28, 2006 (gmt 0)

10+ Year Member



Sorry for the delay.

It has more form objects than this, but they are more or less the same as the balance one shown.

This is what doesn't work in netscape,

<form name="ccform" action="">
<input type="text" name="balance" onblur="validbalance(this.value);" value="balance in here" />
<input type="button" name="Button" value="Calc" onclick="process();" />

But changing to, <form name="ccform">, works in everything, but the drawback is it's not valid markup without the action attribute.

Any ideas?

penders

10:27 am on Sep 29, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hi huds, I changed your
onblur
and
onclick
events into simple
alert()
calls and it worked OK with
action=""
in FF 1.5, Mozila 1.6 and Netscape 4(!)

In fact it makes no difference (to me) whether the action attribute is present or not.

Not sure if you can try setting:

action="javascript:;"

...whether that is really necessary?

Is there a problem with the functions you call?! May need to see the complete form?

huds

11:43 pm on Sep 30, 2006 (gmt 0)

10+ Year Member



Thanks penders, I tried the action="javascript:;" but it still wouldn't work in netscape 8.1.

I think I'll just use a browser redirect on netscapes to a seperate version of the file without the action attribute.

Here's the full form, less table tags (i was in a hurry, hehe).

<form name="ccform" action="">
<div align="center">
<input type="text" name="balance" onblur="validbalance(this.value);" value="balance in here" />
</div>
<div align="center">
<select name="monthcc" >
<option value="1" selected>January</option>
<option value="2">February</option>
<option value="3">March</option>
<option value="4">April</option>
<option value="5">May</option>
<option value="6">June</option>
<option value="7">July</option>
<option value="8">August</option>
<option value="9">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option>
</select>
</div>
<div align="center">
<input type="text" name="yearcc" size="10" value="2010" onblur="validyear(this.value);" />
</div>
<div align="center">
<input type="text" name="payment" value="payment in here" onblur="validpayment(this.value);" />
</div>
<div align="center">
<input type="text" name="apr" onblur="validapr(this.value);" value="apr % in here" />
</div>
<div align="center">
<input type="text" name="payprot" onblur="validprot(this.value);" value="protection % in here" />
</div>
<div align="center">
<script language="JavaScript" type="text/javascript">
<!-- hide js
if (brname=="Microsoft Internet Explorer")
{
document.write("<BUTTON name=\"test\" onClick=\"process();\"><IMG src=\"img/calc.gif\" alt=\"calculate now!\" width=\"41\" height=\"21\"></BUTTON>");
}
else
{
document.write("<input type=\"button\" name=\"Button\" value=\"Calc\" onClick=\"process();\">");
}
// end hide -->
</script>
</div>
<div align="center">
<textarea name="output" cols="100" class="results" rows="20"></textarea>
</div>
</form>

I've searched loads of topics on form attributes, bugs, etc, and still can't understand why it won't work on netscape.
Maybe you're right about the javascript being the problem, I'll check that next.

Cheers

penders

11:07 am on Oct 2, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Does a very simple example, like the following, still not work in Netscape 8.1 ....?

<form name="ccform" action=""> 
<input type="text" name="balance" onblur="alert(this.value);" value="balance in here">
<input type="button" name="Button" value="Calc" onclick="alert('process()');">
</form>

Do the alert boxes show?

huds

5:13 pm on Oct 2, 2006 (gmt 0)

10+ Year Member



That works fine in 8.1. Guess it's something to do with my javascript then.

Could it be because I'm trying to place the output results in another form object on the page?

It would be easier if I could show you the webpage, but I'm not sure about the rules for linking to sites on here.

smells so good

10:17 pm on Oct 2, 2006 (gmt 0)

10+ Year Member



Have you had a look yet at the Javascript Console in Netscape? ( Tools -> Javascript Console ) That should narrow down the problem rather quickly if it is a Javascript error.

huds

9:39 pm on Oct 3, 2006 (gmt 0)

10+ Year Member



Thank you both very much for the help. Checked the console and it turns out my js is a mess right enough.

I will have to use getElementById() instead of referencing id's in the global scope, apparently.

Another weekends work down the drain, oh well.