Link as Form submit

C

Cardinal

In the application I'm developing, I need a link to behave as a form
submit. I set up a little test example below and it worked fine:

<table>
<tr>
<form action="action1.cfm" method="POST" enablecab="No"
name="CareerActionPlanLink">
<td align="center">
<input type="Hidden" name="careerActionPlanID" value="7">
<a href="javascript:document.CareerActionPlanLink.submit();">Edit</a>
</td>
</form>
</tr>
</table>





Then I did it for real and it keeps throwing Javascript errors at me.
Can anyone look at the following code and give me a clue where I might
be going wrong. I'm using fusebox 2 with coldfusion which means that
the form will submit to the index.cfm file. The js error states "Object
does not support this method or property" or words to that effect.
Thank you very much.

<cfoutput query="getRecs">

<tr valign="middle" bgcolor="#IIf(CurrentRow Mod 2, DE('D7F991'),
DE('EDFDCC'))#">
<td height="28">Action Plan: #currentRow#</td>
<td>#CareerDirectionName#</td>
<td>#CompName#</td>
<td>#DateFormat(LastEdited,"mm/dd/yy")#</td>



<form action="#Request.Self#" method="POST" enablecab="No"
name="CareerActionPlanLink">
<input type="Hidden" name="careerActionPlanID"
value="#careerActionPlanID#">
<input type="Hidden" name="fuseaction" value="editCareerActionPlan">
<td align="center">
<a href="javascript:document.CareerActionPlanLink.submit();">Edit</a>
</td>
</form>




<td align="center"><a
href="#Request.Self#?fuseaction=deleteCareerActionPlan&careerActionPlanID=#careerActionPlanID#">Delete</a></td>
</tr>
 
D

David Dorward

Cardinal said:
In the application I'm developing, I need a link to behave as a form
submit.

Bad idea. If the look is so important (and it shouldn't be, the button look
tells the user that it is going to do something with the form and isn't
just a regular link, its generally a bad idea to hide that information from
the user) then you can style the button to look like a link in most
browsers.
<tr>
<form action="action1.cfm" method="POST" enablecab="No"
name="CareerActionPlanLink">
<td align="center">
http://validator.w3.org/

Then I did it for real and it keeps throwing Javascript errors at me.
Can anyone look at the following code and give me a clue where I might
be going wrong.

Its a lot easier to debug code if we can see the code causing the problem
(rather then some Cold Fusion code that when executed will generate the
HTML and JavaScript that you are having trouble with)
 
K

kaeli

In the application I'm developing, I need a link to behave as a form
submit. I set up a little test example below and it worked fine:

A form is not a valid child element of TABLE or TR.
Validate your HTML.
The form should either enclose the table, or the form should be enclosed in
the TD. Nest your elements properly.
The html you posted is invalid and is not equivalent. The first example has
the form nested properly, but as a child of TR. The second is nested
improperly completely (missing <td>).

You're lucky the first one ever worked. Nice of MSIE to fix that for you.

<form>
<table>
<tr>
<td>
<a>link</a>
</td>
</tr>
</table>
</form>

OR

<table>
<tr>
<td>
<form>
<a>link</a>
</form>
</td>
</tr>
</table>

Pick one.

--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top