PDA

View Full Version : button.click() and NS problem


Peanut
10-14-2002, 11:50 AM
Hi, I'm having a problem in Netscape that I'd appreciate some help on.
I'm displaying data records as table rows and allowing the user to select with the cursor. All is fine in IE, but the Javascript button.click() does not work in NS 6...

function offwego(reggie)
{
frmmid.vehicleid.value=reggie;
frmmid.choice_submit.click();
}

---- exerpt of the data table build....

reggie = ucase(objrsvehicles.Fields("vehicle_id"))
<%if strBrowser="IE" then%>
<span title="click to edit vehicle information" onclick="offwego('<%=reggie%>')">
<tr class="InputTableText" style="CURSOR: hand">
<td><%=ucase(objrsvehicles.Fields("vrm"))%>&nbsp;</td>
</tr>
</span>
<%else%>
<span>
<tr class="InputTableText">
<td><a href="javascript:offwego('<%=reggie%>')"><%=ucase(objrsvehicles.Fields("vrm"))%>&nbsp;</a></td>
</span>
<%end if%>

---- the form with the submit button ...

<form action="../vehicle.asp" method="post" name="frmmid" id="frmmid">
<input type="submit" id="choice_submit" name="choice_submit" style="display:none">
<input type="hidden" name="vehicleid">
</form>


I have put an alert() in the javascript and it does get run in NS but does not do anything.
Any pointers would be good (I have already done an extensive search here and elsewhere ....)

Thanks all..... Peanut.

requestcode
10-14-2002, 02:04 PM
I know with NS4 you needed to use the tern "document" when referening items. You might try that like this:
function offwego(reggie)
{
document.frmmid.vehicleid.value=reggie;
document.frmmid.choice_submit.click();
}

IE does nto require this, but NS4 did. Not sure if that will help but I thought I would give it a try.

Peanut
10-14-2002, 03:10 PM
Thanks for the info Requestcode, sounded logical to me so I tried it but unfortunately it didn't do the trick.

I'll bash on and try to find the answer. Cheers anyway....Peanut.

PauletteB
10-14-2002, 05:53 PM
method="get"

Occasionally, I have had the same problems (with NN4 only) not submitting unless I used the get method.

Longshot, but could be worth a try.

adios
10-14-2002, 06:08 PM
Any particular reason why you've chosen the .click() method of the button instead of the .submit() method of the form? Also: there could be a problem with the button CSS (display:none) invalidating its action. Try using document.getElementById() - with an id, naturally - and take out the name attribute temporarily; using both has been known to cause a namespace clash of sorts. That's as many wild guesses as I can come up with now. :)