 | 
March 27th, 2008, 02:17 AM
| | Newbie | | Join Date: Mar 2008
Posts: 3
| | 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
| 
March 27th, 2008, 10:41 AM
| | Newbie | | Join Date: Jan 2007
Posts: 28
| |
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 | | 
March 27th, 2008, 07:18 PM
| | Newbie | | Join Date: Mar 2008
Posts: 3
| | 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.
| 
March 27th, 2008, 07:28 PM
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 12,775
| |
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)?
| 
March 27th, 2008, 07:52 PM
| | Newbie | | Join Date: Mar 2008
Posts: 3
| | 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 - <cfoutput>
-
<cfform name="form" id="form" action="index.cfm" 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="index.cfm?fuseaction=#XFA.test#&log=#attributes.log#&AcctId=#attributes.AcctId#&rn=#attributes.rn#" onclick="document.form.submit();">test</a>
-
</td>
-
</tr>
-
</table>
-
</div>
-
</cfform>
-
</cfoutput>
-
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
| 
March 31st, 2008, 07:19 AM
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 12,775
| |
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".
| 
April 7th, 2008, 12:47 PM
| | Newbie | | Join Date: Jan 2007
Posts: 28
| |
Try this code,it should work. - <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
| 
April 8th, 2008, 10:34 AM
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 12,775
| |
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.
| 
April 8th, 2008, 11:29 AM
| | Newbie | | Join Date: Jan 2007
Posts: 28
| |
Absolutely not required.
I just copied-pasted the url param into the Form's action tag without looking into the copied stuff. :D
|  |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | | | | 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.
|