List Info

Thread: RE: Custom Field Question




RE: Custom Field Question
user name
2007-08-15 22:50:14
Well, your PROPERTIES module for the custom field type would
look something
like this, and allow the developer to stipulate 
What field element in the custom element you're looking to
establish a
dependency with:


<!--- begin properties module --->

<!--- get related fields for custom element --->
<cfquery name="qgetFields"
datasource="#request.site.datasource#">
	select forminputcontrolmap.fieldid,
forminputcontrol.fieldname 
	from forminputcontrol,forminputcontrolmap,customfieldtypes
	where 
		customfieldtypes.type = forminputcontrol.type
		and forminputcontrol.id = forminputcontrolmap.fieldid
		and forminputcontrolmap.formid=#url.formid#
</cfquery>

<cfscript>
	typeid = attributes.typeid;
	prefix = attributes.prefix;
	formname = attributes.formname;
	
	if (not
structkeyexists(attributes.currentvalues,"relatedfield&
quot;)) {
		attributes.currentvalues.relatedfield = "";
	}
</cfscript>



<cfoutput>
	<script language="javascript">
	
fieldProperties['#typeid#'].paramFields='#prefix#relatedfiel
d';
	</script>
	
	<table>

			
			<tr>
				<td><font face="#request.cp.font#"
size="1">Dependent Form Field
Reference:</font></td>
				<td>
					<select name="#prefix#relatedfield">
						<cfloop query="qgetfields">
							<option
value="#fieldid#" <cfif
attributes.currentvalues.relatedfield is
qgetfields.fieldid>selected</cfif>>#replace(qget
fields.fieldname,"FIC_","","
ALL")#</option>
						</cfloop>
					</select>
				</td>
			</tr>
	</table>
	
</cfoutput>

<!--- end properties module --->

Then in your rendering module, you could pick up the
selection from the
properties module:

<cfset linkedobject
="fic_#attributes.fields.formid[1]#_#parameters[fieldqu
ery.inputID].relatedf
ield#">

You _might_ be able to pick up the value the default value
of the dependent
field as:

#attributes.currentvalues[linkedobject]#

But more likely than not, you'd want to pick up the current
value that
they're typing into the dependent field -- which would be
something like
document.forms[0].#linkedobject#.value (assuming the data
was stored in a
hidden/text field).

Anyway, hopefully the above code points you in the right
direction -- not
quite sure from your description what you're actually trying
to accomplish.


Regards,
Steve Drucker
CEO
Fig Leaf Software
Adobe / Google / Paperthin Premier Consulting and Training
Partners
http://www.figleaf.com
http://training.figleaf.c
om


-----Original Message-----
From: commonspot-bounceschattyfig.figleaf.com
[mailto:commonspot-bounceschattyfig.figleaf.com] On
Behalf Of Daniel
Collier
Sent: Wednesday, August 15, 2007 1:44 PM
To: Commonspot Mailing List
Subject: Re: [Commonspot] Custom Field Question

I'm going to pull a set of global custom elements from
Commonspot, but I
believe I know how I'll handle that. However, I don't know
how to determine
the value of another field within the context of my custom
field, so I don't
know the "1,34,927" portion of the query.

The Developer's Guide says the system builds forms from a
query result set.
If I had the name of that query, I could use it to find the
value of the
other fields, but I haven't seen that information in the
documentation.
Commonspot usually offers developers access to structured
data, but I
haven't been able to identify a request scope structure that
holds the list
of form fields and their values.

Mason is using Commonspot, though we do not yet have any
sites live using
it. I'm hoping the College of Humanities and Social Sciences
will have a new
site in Commonspot by November. I'll post something when we
go live. We're
documenting the process, and I'll share that documentation
as well when we
get to a point where it's worth sharing.

D.



On Aug 15, 2007, at 1:15 PM, Kahng, Lucius wrote:

> Are you pulling data from the CommonSpot db from the
custom field, or 
> is it your own database, your own schema? Unless I'm
missing something 
> obvious, you should be able to simply do an inner
join.
> (I call them lookup tables, M$ refers to it as
Master/Detail)
>
> For example:
>
> IDs table       SELECTIONS table
> =========       ================
> ID | NAME       selectionID | ID | NAME
>
> The query:
>
> SELECT S.*
> FROM IDs I
> INNER JOIN Selections s
> ON I.ID = S.ID
> WHERE S.ID IN (1,34,927)
> ORDER BY S.NAME
>
>
> Hope that helps. By the way, is GMU using CommonSpot?
>
>
> Lucius Kahng
> Manager Information Systems
> 703-841-3206(W) - 703-313-8146(M)
> National Electrical Manufacturers Association
>
>
>
> -----Original Message-----
> From: commonspot-bounceschattyfig.figleaf.com
[mailto:commonspot- 
> bounceschattyfig.figleaf.com] On Behalf Of Daniel Collier
> Sent: Wednesday, August 15, 2007 12:20 PM
> To: Commonspot Mailing List
> Subject: [Commonspot] Custom Field Question
>
> I'm writing a custom field type for use on a particular
local custom 
> element. I would like to show different options
depending on the value 
> in another field assigned to the custom element.
>
> In less abstract terms, here's a faked-up custom
element's edit form:
>
>         My Title: Test Data
>         My List of ID Values: 1,34,927
>         [more fields and their values]
>         My Custom field: [runs a query to pull the
options that are 
> related to id values 1,34 and 927, then shows a
selection list of 
> those options]
>
> Within the context of the custom field, how can I know
the values 
> assigned to another field? Do I have to query for that
field's value 
> directly or is there a structure or query result set I
can reference 
> to pull the value?
>
> Thanks,
> Danny Collier
> _______________________________________________
> Commonspotchattyfig.figleaf.com
> To change your subscription options or search the
archive:
> http://chattyfig.figleaf.com/mailman/listinfo/commonspot

>
> Brought to you by Fig Leaf Software
> Premier Authorized Paperthin Consulting and Training 
> http://www.figleaf.com http://training.figleaf.c
om
>
> NEMA's annual meeting, Illuminations Weekend, is
November 9 & 10, 2007 
> Boca Raton Resort & Club Register NOW for
early-bird savings at 
> http://www.nema.org/
illuminations 
> _______________________________________________
> Commonspotchattyfig.figleaf.com
> To change your subscription options or search the
archive:
> http://chattyfig.figleaf.com/mailman/listinfo/commonspot

>
> Brought to you by Fig Leaf Software
> Premier Authorized Paperthin Consulting and Training 
> http://www.figleaf.com http://training.figleaf.c
om

_______________________________________________
Commonspotchattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/commonspot


Brought to you by Fig Leaf Software
Premier Authorized Paperthin Consulting and Training http://www.figleaf.com
http://training.figleaf.c
om

_______________________________________________
Commonspotchattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/commonspot


Brought to you by Fig Leaf Software
Premier Authorized Paperthin Consulting and Training
http://www.figleaf.com
http://training.figleaf.c
om

Re: Custom Field Question
country flaguser name
United States
2007-08-16 07:26:24
Steve,

That's very helpful. Thank you. In case anyone is
interested, here's  
a description of what we're trying to do.

We are using one Cspot site to hold our many public sites.
We plan to  
share a great deal of data among our sites, including
faculty and  
staff bios, course listings, events, etc. Each of our sites
consists  
of a root Cspot subsite, with additional subsites beneath
that site  
representing the site's sections
("english/events", "history/ 
events"). Each subsite within a given site has a
template variable  
called "siteRoot" which we set to the siteID value
of the root subsite.

We are using the Cspot APIs to import and update basic
information  
about the university's faculty and staff from a system
called Banner,  
which the university uses for HR and other purposes. We
import the  
faculty and staff members to local custom elements stored in
a single  
subsite. We display these bios on faculty and staff pages on
other  
subsites for our different departments, pulling the relevant
faculty  
based on the siteRoot value. A particular faculty member may
show up  
on multiple subsites; for instance, one might teach in
English and  
also in History. We assign the faculty members to subsites
on import,  
using one field that contains a list of subsite ID values,
and allow  
administrators to manually assign faculty to other subsites
by  
entering ID values in another field.

Each department may have its own way of grouping faculty
members by  
discipline. English has linguistics, literature and creative
writing,  
while History has world history, Asian history, etc. We need
to allow  
users to assign disciplines to individual faculty members.
We want  
them only to see the disciplines that are relevant to that 

individual's assigned departments. We want the department
site  
administrators to be able to edit their list of disciplines
without  
data problems--i.e. change "creative writing" to
"writing" and have  
the change be reflected in all bios which have been assigned
that  
discipline.

We have created the disciplines as global custom elements
consisting  
of the discipline name and a subsiteid value.

I hope that gives a clearer picture of the overall
situation.

Thanks,
Danny

On Aug 15, 2007, at 11:50 PM, Steve Drucker wrote:

> Well, your PROPERTIES module for the custom field type
would look  
> something
> like this, and allow the developer to stipulate
> What field element in the custom element you're looking
to establish a
> dependency with:
>
>
> <!--- begin properties module --->
>
> <!--- get related fields for custom element --->
> <cfquery name="qgetFields"
datasource="#request.site.datasource#">
> 	select forminputcontrolmap.fieldid,
forminputcontrol.fieldname
> 	from
forminputcontrol,forminputcontrolmap,customfieldtypes
> 	where
> 		customfieldtypes.type = forminputcontrol.type
> 		and forminputcontrol.id =
forminputcontrolmap.fieldid
> 		and forminputcontrolmap.formid=#url.formid#
> </cfquery>
>
> <cfscript>
> 	typeid = attributes.typeid;
> 	prefix = attributes.prefix;
> 	formname = attributes.formname;
> 	
> 	if (not
structkeyexists(attributes.currentvalues,"relatedfield&
quot;)) {
> 		attributes.currentvalues.relatedfield =
"";
> 	}
> </cfscript>
>
>
>
> <cfoutput>
> 	<script language="javascript">
> 	
>
fieldProperties['#typeid#'].paramFields='#prefix#relatedfiel
d';
> 	</script>
> 	
> 	<table>
>
> 			
> 			<tr>
> 				<td><font
face="#request.cp.font#"
> size="1">Dependent Form Field
Reference:</font></td>
> 				<td>
> 					<select
name="#prefix#relatedfield">
> 						<cfloop query="qgetfields">
> 							<option
> value="#fieldid#" <cfif
attributes.currentvalues.relatedfield is
> qgetfields.fieldid>selected</cfif>>#replace

>
(qgetfields.fieldname,"FIC_","","
> ALL")#</option>
> 						</cfloop>
> 					</select>
> 				</td>
> 			</tr>
> 	</table>
> 	
> </cfoutput>
>
> <!--- end properties module --->
>
> Then in your rendering module, you could pick up the
selection from  
> the
> properties module:
>
> <cfset linkedobject
> ="fic_#attributes.fields.formid[1]#_#parameters 
> [fieldquery.inputID].relatedf
> ield#">
>
> You _might_ be able to pick up the value the default
value of the  
> dependent
> field as:
>
> #attributes.currentvalues[linkedobject]#
>
> But more likely than not, you'd want to pick up the
current value that
> they're typing into the dependent field -- which would
be something  
> like
> document.forms[0].#linkedobject#.value (assuming the
data was  
> stored in a
> hidden/text field).
>
> Anyway, hopefully the above code points you in the
right direction  
> -- not
> quite sure from your description what you're actually
trying to  
> accomplish.
>
>
> Regards,
> Steve Drucker
> CEO
> Fig Leaf Software
> Adobe / Google / Paperthin Premier Consulting and
Training Partners
> http://www.figleaf.com
> http://training.figleaf.c
om
>
>
> -----Original Message-----
> From: commonspot-bounceschattyfig.figleaf.com
> [mailto:commonspot-bounceschattyfig.figleaf.com] On
Behalf Of Daniel
> Collier
> Sent: Wednesday, August 15, 2007 1:44 PM
> To: Commonspot Mailing List
> Subject: Re: [Commonspot] Custom Field Question
>
> I'm going to pull a set of global custom elements from
Commonspot,  
> but I
> believe I know how I'll handle that. However, I don't
know how to  
> determine
> the value of another field within the context of my
custom field,  
> so I don't
> know the "1,34,927" portion of the query.
>
> The Developer's Guide says the system builds forms from
a query  
> result set.
> If I had the name of that query, I could use it to find
the value  
> of the
> other fields, but I haven't seen that information in
the  
> documentation.
> Commonspot usually offers developers access to
structured data, but I
> haven't been able to identify a request scope structure
that holds  
> the list
> of form fields and their values.
>
> Mason is using Commonspot, though we do not yet have
any sites live  
> using
> it. I'm hoping the College of Humanities and Social
Sciences will  
> have a new
> site in Commonspot by November. I'll post something
when we go  
> live. We're
> documenting the process, and I'll share that
documentation as well  
> when we
> get to a point where it's worth sharing.
>
> D.
>
>
>
> On Aug 15, 2007, at 1:15 PM, Kahng, Lucius wrote:
>
>> Are you pulling data from the CommonSpot db from
the custom field, or
>> is it your own database, your own schema? Unless
I'm missing  
>> something
>> obvious, you should be able to simply do an inner
join.
>> (I call them lookup tables, M$ refers to it as
Master/Detail)
>>
>> For example:
>>
>> IDs table       SELECTIONS table
>> =========       ================
>> ID | NAME       selectionID | ID | NAME
>>
>> The query:
>>
>> SELECT S.*
>> FROM IDs I
>> INNER JOIN Selections s
>> ON I.ID = S.ID
>> WHERE S.ID IN (1,34,927)
>> ORDER BY S.NAME
>>
>>
>> Hope that helps. By the way, is GMU using
CommonSpot?
>>
>>
>> Lucius Kahng
>> Manager Information Systems
>> 703-841-3206(W) - 703-313-8146(M)
>> National Electrical Manufacturers Association
>>
>>
>>
>> -----Original Message-----
>> From: commonspot-bounceschattyfig.figleaf.com
[mailto:commonspot-
>> bounceschattyfig.figleaf.com] On Behalf Of Daniel
Collier
>> Sent: Wednesday, August 15, 2007 12:20 PM
>> To: Commonspot Mailing List
>> Subject: [Commonspot] Custom Field Question
>>
>> I'm writing a custom field type for use on a
particular local custom
>> element. I would like to show different options
depending on the  
>> value
>> in another field assigned to the custom element.
>>
>> In less abstract terms, here's a faked-up custom
element's edit form:
>>
>>         My Title: Test Data
>>         My List of ID Values: 1,34,927
>>         [more fields and their values]
>>         My Custom field: [runs a query to pull the
options that are
>> related to id values 1,34 and 927, then shows a
selection list of
>> those options]
>>
>> Within the context of the custom field, how can I
know the values
>> assigned to another field? Do I have to query for
that field's value
>> directly or is there a structure or query result
set I can reference
>> to pull the value?
>>
>> Thanks,
>> Danny Collier
>> _______________________________________________
>> Commonspotchattyfig.figleaf.com
>> To change your subscription options or search the
archive:
>> http://chattyfig.figleaf.com/mailman/listinfo/commonspot

>>
>> Brought to you by Fig Leaf Software
>> Premier Authorized Paperthin Consulting and
Training
>> http://www.figleaf.com http://training.figleaf.c
om
>>
>> NEMA's annual meeting, Illuminations Weekend, is
November 9 & 10,  
>> 2007
>> Boca Raton Resort & Club Register NOW for
early-bird savings at
>> http://www.nema.org/
illuminations
>> _______________________________________________
>> Commonspotchattyfig.figleaf.com
>> To change your subscription options or search the
archive:
>> http://chattyfig.figleaf.com/mailman/listinfo/commonspot

>>
>> Brought to you by Fig Leaf Software
>> Premier Authorized Paperthin Consulting and
Training
>> http://www.figleaf.com http://training.figleaf.c
om
>
> _______________________________________________
> Commonspotchattyfig.figleaf.com
> To change your subscription options or search the
archive:
> http://chattyfig.figleaf.com/mailman/listinfo/commonspot

>
> Brought to you by Fig Leaf Software
> Premier Authorized Paperthin Consulting and Training
http:// 
> www.figleaf.com
> http://training.figleaf.c
om
>
> _______________________________________________
> Commonspotchattyfig.figleaf.com
> To change your subscription options or search the
archive:
> http://chattyfig.figleaf.com/mailman/listinfo/commonspot

>
> Brought to you by Fig Leaf Software
> Premier Authorized Paperthin Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.c
om

_______________________________________________
Commonspotchattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/commonspot


Brought to you by Fig Leaf Software
Premier Authorized Paperthin Consulting and Training
http://www.figleaf.com
http://training.figleaf.c
om

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )