Link as Form submit

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Cardinal

    #1

    Link as Form submit

    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="CareerAct ionPlanLink">
    <td align="center">
    <input type="Hidden" name="careerAct ionPlanID" value="7">
    <a href="javascrip t:document.Care erActionPlanLin k.submit();">Ed it</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(C urrentRow Mod 2, DE('D7F991'),
    DE('EDFDCC'))#" >
    <td height="28">Act ion Plan: #currentRow#</td>
    <td>#CareerDire ctionName#</td>
    <td>#CompName #</td>
    <td>#DateFormat (LastEdited,"mm/dd/yy")#</td>



    <form action="#Reques t.Self#" method="POST" enablecab="No"
    name="CareerAct ionPlanLink">
    <input type="Hidden" name="careerAct ionPlanID"
    value="#careerA ctionPlanID#">
    <input type="Hidden" name="fuseactio n" value="editCare erActionPlan">
    <td align="center">
    <a href="javascrip t:document.Care erActionPlanLin k.submit();">Ed it</a>
    </td>
    </form>




    <td align="center"> <a
    href="#Request. Self#?fuseactio n=deleteCareerA ctionPlan&caree rActionPlanID=# careerActionPla nID#">Delete</a></td>
    </tr>

  • David Dorward

    #2
    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="CareerAct ionPlanLink">
    > <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

    Comment

    • kaeli

      #3
      Re: Link as Form submit

      In article <1116324937.044 042.153610@g14g 2000cwa.googleg roups.com>,
      john.menken@cer idian.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.



      Comment

      Working...