Link to home
Start Free TrialLog in
Avatar of nickel2001
nickel2001

asked on

Passing a form object to a custom tag

Greetings!
I was wondering if anyone could tell me how to 1)pass a form object to a custom tag 2)access the form data in the custom tag.

Thanks

Nickel
ASKER CERTIFIED SOLUTION
Avatar of CFXPERT
CFXPERT

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CFXPERT
CFXPERT

Sorry also if you wanna pass for emelents use:

<cf_embedfields>in between you <form> tags

then in cutom tag you can get them simply by calling their name like #username# or whatever the field name happens to be you need the value from.
Any luck yet?
reference to cfexperts comment to invoke custome tag
attributes is not required. no need to give comma between the atrributes variables.

to pass variables to the tag use:

<cf_tagname test = 1 test2 = 2>

is enough to call any cfm files with name tagname.cfm.

to retrive the value what he was explianed is correct
Hi there,

U can use the following code to get to know - how to use cutom tags & play around with them.

let me know incase u ahve some difficulties

K'Rgds
Anand

=======================================================

<HTML>
<HEAD>
     <TITLECustom tag</TITLE>
</HEAD>

<BODY>

<!--- assuming the form is submitted to this page --->

<cfset username="form.username">
<CFSET usepwd = "from.password">

<cf_Tag user="#UserName#" pass="#UsePwd#">

<!--- ========================================================================================================== --->

<!--- code for the tag in a seperate file called tag.cfm - is down below --->

<CFIF ISDEFINED('ATTRIBUTES.User') AND ISDEFINED('ATTRIBUTES.PASS')>

<!--- do ur tag processing here like --->
     <CFQUERY NAME="Check_Reg_Password" DATASOURCE="#IWD_DSN#" DBTYPE="ODBC" username="#IWD_USERNAME#" PASSWORD="#IWD_PASSWORD#">    
          Insert into TblUsers values ('#Attributes.User#','#Attributes.Pass#')
     </CFQUERY>    

</CFIF>

<!--- save this fiel as Tag.cfm --->
<!--- ========================================================================================================== --->

<!--- there u r done --->
</BODY>
</HTML>