Connecting Tech Pros Worldwide Help | Site Map

Link as Form submit

  #1  
Old July 23rd, 2005, 08:51 PM
Cardinal
Guest
 
Posts: n/a
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.sub mit();">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.sub mit();">Edit</a>
</td>
</form>




<td align="center"><a
href="#Request.Self#?fuseaction=deleteCareerAction Plan&careerActionPlanID=#careerActionPlanID#">Dele te</a></td>
</tr>

  #2  
Old July 23rd, 2005, 08:51 PM
David Dorward
Guest
 
Posts: n/a

re: Link as Form submit


Cardinal wrote:
[color=blue]
> In the application I'm developing, I need a link to behave as a form
> submit.[/color]

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.
[color=blue]
> <tr>
> <form action="action1.cfm" method="POST" enablecab="No"
> name="CareerActionPlanLink">
> <td align="center">[/color]

http://validator.w3.org/
[color=blue]
> 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.[/color]

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)


--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
  #3  
Old July 23rd, 2005, 08:52 PM
kaeli
Guest
 
Posts: n/a

re: Link as Form submit


In article <1116324937.044042.153610@g14g2000cwa.googlegroups .com>,
john.menken@ceridian.com enlightened us with...[color=blue]
> 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:
>[/color]

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.

--
--
~kaeli~
A boiled egg in the morning is hard to beat.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
want to link form.submit to button_clik method Billy answers 2 November 17th, 2005 10:14 PM
form submit problem Martin Nadoll answers 2 July 23rd, 2005 12:16 PM