Help | Site Map
Connecting Tech Pros Worldwide
Reply
 
LinkBack Thread Tools
  #1  
Old March 27th, 2008, 02:17 AM
Newbie
 
Join Date: Mar 2008
Posts: 3
Default 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
Reply
  #2  
Old March 27th, 2008, 10:41 AM
Newbie
 
Join Date: Jan 2007
Posts: 28
Default

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

Hussain


Quote:
Originally Posted by jolakammu
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
Reply
  #3  
Old March 27th, 2008, 07:18 PM
Newbie
 
Join Date: Mar 2008
Posts: 3
Default

Quote:
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="#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.
Reply
  #4  
Old March 27th, 2008, 07:28 PM
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 12,775
Default

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)?
Reply
  #5  
Old March 27th, 2008, 07:52 PM
Newbie
 
Join Date: Mar 2008
Posts: 3
Default

Quote:
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


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

Last edited by acoder; March 31st, 2008 at 07:17 AM. Reason: Added code tags
Reply
  #6  
Old March 31st, 2008, 07:19 AM
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 12,775
Default

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".
Reply
  #7  
Old April 7th, 2008, 12:47 PM
Newbie
 
Join Date: Jan 2007
Posts: 28
Default

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
Reply
  #8  
Old April 8th, 2008, 10:34 AM
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 12,775
Default

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.
Reply
  #9  
Old April 8th, 2008, 11:29 AM
Newbie
 
Join Date: Jan 2007
Posts: 28
Default

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

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles