Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Getting Started / March 2007



Tip: Looking for answers? Try searching our database.

trying to create a custom tag

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
numerical07 - 28 Mar 2007 21:55 GMT
I want to create a custom tag that has a attribute that ask for a number. like
below...

<cf_makeattributes number="?">

Now say I made that number something like 5

<cf_makeattributesnumber=[b]"5"[/b]>

I would like for the tag to take that number and make 5 attributes called
"Form" in a array from 1 to 5 like below...
<cfset attributes.form = arraynew(1)>
<cfloop index="i" from="1" to="#attributes.number#">
#attributes.form[i]#
</cfloop>

Is it possible to make a tag that ask for a number like 5 and  make 5
attributes and within the same tag assign values to those 5 attributes. for
example consider the above.

<cf_makeattributes number="5" attribute1="hi" attribute2="hello"
attribute3="howdy" attribute4="hey" attribute5="HOWE!">

or say i want to make 2 attributes and assign 2 values to those attributes

<cf_makeattributes number="2" attribute1="This tag asked for 2 numbers"
attribute2="and therefore gave me the ability to make 2 attributes">
Ian Skinner - 28 Mar 2007 22:21 GMT
odd requirement.

I would think it would be do able.  I would start off with an idea
something like this.

<cfset itterations = 5>
<cfset values="1,2,3,4,5">

<cf_makeattributes number=itterations values=values>

You could do more if you made values a structure or array.
cf_dev2 - 28 Mar 2007 22:28 GMT
I'm not sure I understand your goal.  You want to pass in an arbitrary number
of values (1-n) and convert them to an array that is returned to the calling
page.. ?

YourArray[1] = "hello"
YourArray[2] = "world"

Is the order of the values significant?
numerical07 - 28 Mar 2007 23:53 GMT
Ok, Say if I had a form that had 5 input text boxs. And I wanted to insert them
into a database. So I made a tag that was made to help insert forms into
databases easier. This tag is universal and can be used for any type of
database entry. First I would Have to tell the tag how many form entries I
have. I could either make a bunch of attributes that will grab all the values
or I could loop out a array of attributes. Thats my goal
cf_dev2 - 29 Mar 2007 00:41 GMT
> I could either make a bunch of attributes that will grab all the
> values or I could loop out a array of attributes. Thats my goal

I was with you until that line.  The term attributes is confusing in this
context.  I'm not sure if you're talking about attributes in a generic sense or
the custom tag attribute [i]scope[/i].

Let's  try this from a different angle.   Can you give a concrete example of
the desired results using this form?

<form>
   <input name="username1" value="Alice">
   <input name="username2" value="Bob">
   <input name="username3" value="Kyle">
   <input name="username4" value="Michelle">
   <input name="username5" value="Robert">
   ...
</form>
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.