Coding with Firefox: Alternative for "onclick"?

madmatt

Awesome is as awesome does.
Political Access
Joined
5 Apr 2002
Messages
13,314
I'll admit, I am the typical Microsoft guy who doesn't bother with Firefox. I received an email from a client today with a problem that their online job application is not coming through. I decided to install Firefox on a virtual OS and see if it had something to do with the way Firefox handles the code.

I didn't find a problem with the initial application but with the next step in the process.

I am using a text link with the "onclick" property.

PHP:
<a href="#" class="menulink" onClick="submit();">Click here to take the affirmative action online survey.</a>

I know there is a problem because Firefox does not support "onclick". Weird.

I got tired of researching it so decided to ask. Thank you.
 
no caps, try onclick rather than onClick

Also, you may need to be specific about the form being submitted.

Alternatively, you can embed javascript in the href attribute.

Like,
Code:
<a href="javascript:document.getElementById('frmGoogleSearch').submit();">Google Search!</a>
 
Last edited:
as albybum said its most likely to be the attribute case. if you want to try it in firefox with a javascript console then download firebug as well for firefox
 
I'm not making any progress.

PHP:
<form method="POST" name="aasurvey" action="index.php?show=careers&sub=aasurvey">

  <input type="hidden" name="position" value="<?php print $_POST['position']; ?>">
  <input type="hidden" name="date" value="<?php print date('m/d/Y'); ?>">
  <input type="hidden" name="howDid" value="<?php print $_POST['howDid']; ?>">
  <input type="hidden" name="firstName" value="<?php print $_POST['firstName']; ?>">
  <input type="hidden" name="middleName" value="<?php print $_POST['middleName']; ?>">
  <input type="hidden" name="lastName" value="<?php print $_POST['lastName']; ?>">
  <input type="hidden" name="address" value="<?php print $_POST['address']; ?>">
  <input type="hidden" name="address2" value="<?php print $_POST['address2']; ?>">
  <input type="hidden" name="city" value="<?php print $_POST['city']; ?>">
  <input type="hidden" name="state" value="<?php print $_POST['state']; ?>">
  <input type="hidden" name="zipCode" value="<?php print $_POST['zipCode']; ?>">
  <input type="hidden" name="country" value="<?php print $_POST['country']; ?>">
  <input type="hidden" name="phoneNumber1" value="<?php print $_POST['phoneNumber1']; ?>">
  <input type="hidden" name="phoneNumber2" value="<?php print $_POST['phoneNumber2']; ?>">
  <input type="hidden" name="ssn" value="<?php print $_POST['ssn']; ?>">
  <input type="hidden" name="emailAddress1" value="<?php print $_POST['emailAddress1']; ?>">
  <input type="hidden" name="emailAddress2" value="<?php print $_POST['emailAddress2']; ?>">

  In an effort to comply with requirements regarding government recordkeeping, reporting, and other legal obligations which may apply, we invite you to complete the <a href="javascript:void(0);" class="menulink" onClick="submit();">affirmative action online survey</a>.  Providing this information is <b>STICTLY VOLUNTARY</b>.  Failure to provide it will not subject you to any adverse personnel decision or action.<br>

  &nbsp;<br>

  <a href="javascript:document.getElementById('aasurvey').submit();" class="menulink">Click here to take the affirmative action online survey.</a>

</form>

See final a href.

First, I changed "onClick" to "onclick". No difference.

Next, I changed it to the statement that alby suggested. No difference.

Next, I installed Firebug and it's not telling me there is anything wrong.

Furthmore, the statement alby gave me works perfectly with IE6 and IE7.
 
Last edited:
you are using "getElementById" but have not set the id of the form.

Add id="aasurvey" to your form tag
 
Oh gee now I feel dumb. Thanks everyone.
 
This also works.

Code:
<a href="#" class="menulink" onclick="document.aasurvey.submit();">Click here to take the affirmative action online survey.</a>
 
This also works.

Code:
<a href="#" class="menulink" onclick="document.aasurvey.submit();">Click here to take the affirmative action online survey.</a>

It won't properly on certain browsers. Since some browsers won't populate the document namespace with all the "id" attributes. Konqueror being a prime example, neither does Safari.
 

Members online

No members online now.

Latest profile posts

Also Hi EP and people. I found this place again while looking through a oooollllllldddd backup. I have filled over 10TB and was looking at my collection of antiques. Any bids on the 500Mhz Win 95 fix?
Any of the SP crew still out there?
Xie wrote on Electronic Punk's profile.
Impressed you have kept this alive this long EP! So many sites have come and gone. :(

Just did some crude math and I apparently joined almost 18yrs ago, how is that possible???
hello peeps... is been some time since i last came here.
Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.

Forum statistics

Threads
62,015
Messages
673,494
Members
5,621
Latest member
naeemsafi
Back