submit from on click from hyper link

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jolakammu
    New Member
    • Mar 2008
    • 3

    submit from on click from hyper link

    Guys,

    I am calling onclick="docume nt.form.submit( );" in a hyper clink.

    On click, it goes to a fuseaction where act_load_struct ure.cfm loads the structure with form variable.

    But the form fields are not avaibale in act_load_struct ure.cfm . It says form fields are not defined. Do you know why.

    I appreciate your help in advance
  • hussain123
    New Member
    • Jan 2007
    • 28

    #2
    I think you have specified the cfm path in the href attribute of the link.
    Remove that!!! Then it should work.

    Hussain


    Originally posted by jolakammu
    Guys,

    I am calling onclick="docume nt.form.submit( );" in a hyper clink.

    On click, it goes to a fuseaction where act_load_struct ure.cfm loads the structure with form variable.

    But the form fields are not avaibale in act_load_struct ure.cfm . It says form fields are not defined. Do you know why.

    I appreciate your help in advance

    Comment

    • jolakammu
      New Member
      • Mar 2008
      • 3

      #3
      Originally posted by hussain123
      I think you have specified the cfm path in the href attribute of the link.
      Remove that!!! Then it should work.

      Hussain

      here is by href. what do i need to remove.

      <a href="#Attribut es.TemplateURL# ?CurrentPage=#C ount##Attribute s.AddedPath#" onclick="docume nt.form.submit( );">

      with this, it is going to the correct fuse action but the form variables are not available.

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Show the form code. What is the method of submitting, GET or POST? Are you retrieving the form values as GET (url.formvar) or POST (form.formvar)?

        Comment

        • jolakammu
          New Member
          • Mar 2008
          • 3

          #5
          Originally posted by acoder
          Show the form code. What is the method of submitting, GET or POST? Are you retrieving the form values as GET (url.formvar) or POST (form.formvar)?

          Here is the dsp page


          [CODE=cfm]<cfoutput>
          <cfform name="form" id="form" action="index.c fm" method="post">
          <table>
          <tr>
          <td>
          <input type="text" name="log" value="#attribu tes.log#" />
          <input type="text" name="AcctId" value="#attribu tes.AcctId#" />
          <input type="text" name="tablename " value="test" />
          </td>
          </tr>
          </table>
          <table width="100%">
          <tr>
          <td align="left">
          <a href="index.cfm ?fuseaction=#XF A.test#&amp;log =#attributes.lo g#&amp;AcctId=# attributes.Acct Id#&amp;rn=#att ributes.rn#" onclick="docume nt.form.submit( );">test</a>
          </td>
          </tr>
          </table>
          </div>
          </cfform>
          </cfoutput>
          [/CODE]

          Here is the destination page

          <cfoutput> tablename = #form.tablename #</cfoutput>
          <cfabort>

          or

          <cfoutput> tablename = #tablename#</cfoutput>
          <cfabort>


          I appreaciate your help
          Last edited by acoder; Mar 31 '08, 06:17 AM. Reason: Added code tags

          Comment

          • acoder
            Recognized Expert MVP
            • Nov 2006
            • 16032

            #6
            Make the link into a submit button and/or move the href into the action attribute of the form. At the moment, it's posting to just "index.cfm" .

            Comment

            • hussain123
              New Member
              • Jan 2007
              • 28

              #7
              Try this code,it should work.


              Code:
                   <cfoutput>
              
                    <cfform name="form" id="form" action="index.cfm?fuseaction=#XFA.test#&log=#attributes.lo  g#&AcctId=#attributes.AcctId#&rn=#attributes.rn#" method="post">
              
                    <table>
              
                        <tr>
              
                            <td>
              
                                <input type="text" name="log" value="#attributes.log#" />
               
                                <input type="text" name="AcctId" value="#attributes.AcctId#" />  
              
                                <input type="text" name="tablename" value="test" />             
                            </td>
                        </tr>
                     </table>
                     <table width="100%">
                     <tr>
                    <td align="left">
                        <a href="##" onclick="document.form.submit();">test</a>
                    </td>
                    </tr>
                    </table>
                    </div>
                     </cfform>
                     </cfoutput>
              Hussain

              Comment

              • acoder
                Recognized Expert MVP
                • Nov 2006
                • 16032

                #8
                That should work about right.

                To the OP: you're passing the attributes.log/AcctId values in the URL and the form values of the same name will also be posted. Is this necessary? Thought I'd just point out.

                Comment

                • hussain123
                  New Member
                  • Jan 2007
                  • 28

                  #9
                  Absolutely not required.
                  I just copied-pasted the url param into the Form's action tag without looking into the copied stuff. :D

                  Comment

                  Working...