469,312 Members | 2,503 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,312 developers. It's quick & easy.

submit from on click from hyper link

Guys,

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

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

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

I appreciate your help in advance
Mar 27 '08 #1
8 5624
I think you have specified the cfm path in the href attribute of the link.
Remove that!!! Then it should work.

Hussain


Guys,

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

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

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

I appreciate your help in advance
Mar 27 '08 #2
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="#Attributes.TemplateURL#?CurrentPage=#Count# #Attributes.AddedPath#" onclick="document.form.submit();">

with this, it is going to the correct fuse action but the form variables are not available.
Mar 27 '08 #3
acoder
16,027 Expert Mod 8TB
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)?
Mar 27 '08 #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)?

Here is the dsp page


Expand|Select|Wrap|Line Numbers
  1. <cfoutput>
  2. <cfform name="form" id="form" action="index.cfm" method="post">
  3. <table>
  4.     <tr>
  5.         <td>
  6.             <input type="text" name="log" value="#attributes.log#" />
  7.             <input type="text" name="AcctId" value="#attributes.AcctId#" />        
  8.             <input type="text" name="tablename" value="test" />                    
  9.         </td>
  10.     </tr>
  11. </table>
  12. <table width="100%">
  13. <tr>
  14. <td align="left">
  15.     <a href="index.cfm?fuseaction=#XFA.test#&amp;log=#attributes.log#&amp;AcctId=#attributes.AcctId#&amp;rn=#attributes.rn#" onclick="document.form.submit();">test</a>
  16. </td>
  17. </tr>
  18. </table> 
  19. </div>
  20. </cfform>
  21. </cfoutput>
  22.  
Here is the destination page

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

or

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


I appreaciate your help
Mar 27 '08 #5
acoder
16,027 Expert Mod 8TB
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".
Mar 31 '08 #6
Try this code,it should work.


Expand|Select|Wrap|Line Numbers
  1.      <cfoutput>
  2.  
  3.       <cfform name="form" id="form" action="index.cfm?fuseaction=#XFA.test#&log=#attributes.lo  g#&AcctId=#attributes.AcctId#&rn=#attributes.rn#" method="post">
  4.  
  5.       <table>
  6.  
  7.           <tr>
  8.  
  9.               <td>
  10.  
  11.                   <input type="text" name="log" value="#attributes.log#" />
  12.  
  13.                   <input type="text" name="AcctId" value="#attributes.AcctId#" />  
  14.  
  15.                   <input type="text" name="tablename" value="test" />             
  16.               </td>
  17.           </tr>
  18.        </table>
  19.        <table width="100%">
  20.        <tr>
  21.       <td align="left">
  22.           <a href="##" onclick="document.form.submit();">test</a>
  23.       </td>
  24.       </tr>
  25.       </table>
  26.       </div>
  27.        </cfform>
  28.        </cfoutput>
  29.  
Hussain
Apr 7 '08 #7
acoder
16,027 Expert Mod 8TB
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.
Apr 8 '08 #8
Absolutely not required.
I just copied-pasted the url param into the Form's action tag without looking into the copied stuff. :D
Apr 8 '08 #9

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Stanimir Stamenkov | last post: by
4 posts views Thread by jim | last post: by
7 posts views Thread by bill | last post: by
26 posts views Thread by Mica Cooper | last post: by
1 post views Thread by doris1202004 | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Geralt96 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.