Keyword field of a content type with comma delimited string entry

9 views
Skip to first unread message

Ron Mast

unread,
Aug 12, 2010, 4:36:08 PM8/12/10
to farcr...@googlegroups.com
When editing a content type field (Keyword) type longchar. The entry
is comma delimited...but I want to avoid duplicate words making this
example an invalid entry: "farcry, is, awesome, farcry, rules".
Because farcry is used twice I would like to not allow this to save.

I wanted to ask the group before I start reading through the
documentation and writing code. Has anyone done this? Perhaps farcry
already can validate this?

Thank you for understanding my newbie status! :)

Bryce Hoffmann

unread,
Aug 12, 2010, 8:22:47 PM8/12/10
to farcr...@googlegroups.com
Hi
Do we have any developers on list that have built a Farcry Tourism Site?
Or know of an example Farcry site?
Needs to handle multiple events (calendars) uploaded by participating members.
Along the lines of: http://www.maitlandhuntervalley.com.au/


Regards
Bryce Hoffmann :-)


*********** Confidentiality and Disclaimer Statement *****************
The information in this e-mail and any attachments are confidential and may be subject to legal professional privilege. It is intended solely for the attention and use of the named addressee(s). If you are not the intended recipient, or person responsible for delivering this information to the intended recipient, please notify the sender immediately. Unless you are the intended recipient or his/her representative you are not authorised to, and must not read, copy, distribute, use or retain this message or any part of it.

Opinions, conclusions and other information expressed in this message are not given or endorsed by NCC unless otherwise indicated by an authorised officer independent of this message.

NCC has implemented anti-virus software, and whilst all care is taken, it is the recipient's responsibility to ensure that the message and any attachments are scanned for viruses prior to use.

This footnote also confirms this e-mail message has been read electronically by an e-mail content breakdown system.

Newcastle City Council
Web: http://www.newcastle.nsw.gov.au
E-mail: ma...@ncc.nsw.gov.au

Phillip R

unread,
Aug 12, 2010, 11:31:25 PM8/12/10
to farcry-dev
Hi Ron,
You could add a 'BeforeSave' function on the type and run some logic
over the field in question. Have a look at dmFile.cfc as a good
example of this.
Phil

Sean Coyne

unread,
Aug 13, 2010, 7:37:23 AM8/13/10
to farcry-dev
Ron,

You can create a ftValidateKeyword method (assuming your field name is
"keyword") and FarCry will execute it.

Check out /core/packages/types/farUser.cfc you can see that they built
an ftValidateUserID method to validate the userID. Your method would
use the same areguments, returntype, etc.

OR

You can create your own formtool type, say "keywordList". You would
create a keywordlist.cfc in your /project/packages/formtools folder
then for your "keyword" field use a ftType="keywordlist". You can
look at any of the other formtool CFCs for examples of how to
construct your edit, display, validate and any other methods.


Sean

Ron Mast

unread,
Aug 13, 2010, 10:45:27 AM8/13/10
to farcr...@googlegroups.com
Shawn I'm trying the ftValidateKeywords method. Keywords is the field name.

Looking at the farUser.cfc example. I did a selected resources search
trying to find how the ftValidateUserID function is getting invoked so
I can get a better understanding. I didn't find anything.

I created the ftValidateKeywords in mysite/packages/types/course.cfc

I am at loss of how to now use my ftValidateKeywords function.

Thanks!

> --
> You received this message cos you are subscribed to "farcry-dev" Google group.
> To post, email: farcr...@googlegroups.com
> To unsubscribe, email: farcry-dev+...@googlegroups.com
> For more options: http://groups.google.com/group/farcry-dev
> --------------------------------
> Follow us on Twitter: http://twitter.com/farcry

Ron Mast

unread,
Aug 13, 2010, 12:07:34 PM8/13/10
to farcr...@googlegroups.com
This is bizarre...I created ftValidateKeywords and making sure it
fails...yet when I save bSuccess=false is not recognized. I have the
same data structure as farUser.cfc when I dump arguments and cfabort.

Any clue to why? It's running the ftValidateKeywords because it's
dumping the arguments.

Thanks again!

Sean Coyne

unread,
Aug 13, 2010, 3:40:42 PM8/13/10
to farcry-dev
You should be creating your returns struct using the "passed" and
"failed" methods like farUser:

<cfset stResult = createObject("component",
application.formtools["field"].packagePath).failed(value="#arguments.stFieldPost.value#",
message="The userid you have selected is already taken.") />

<cfset stResult = createObject("component",
application.formtools["field"].packagePath).passed(value=stFieldPost.Value) /
>

FarCry automatically invokes the ftValidate* methods for each field
(if they exist). FarCry is a conventions based framework. Its
magic :)

I think there may be a bug in FarCry that prevents the
<ft:serverSideValidation /> tag from firing. You may have to create
your own edit.cfm handler and manually add in a call to
<ft:serverSideValidation />. Hopefully someone from Daemon will chime
in a shed some light.


Sean




On Aug 13, 12:07 pm, Ron Mast <ron...@gmail.com> wrote:
> This is bizarre...I created ftValidateKeywords and making sure it
> fails...yet when I save bSuccess=false is not recognized. I have the
> same data structure as farUser.cfc when I dump arguments and cfabort.
>
> Any clue to why? It's running the ftValidateKeywords because it's
> dumping the arguments.
>
> Thanks again!
>
>
>
> On Fri, Aug 13, 2010 at 9:45 AM, Ron Mast <ron...@gmail.com> wrote:
> > Shawn I'm trying the ftValidateKeywords method. Keywords is the field name.
>
> > Looking at the farUser.cfc example. I did a selected resources search
> > trying to find how the ftValidateUserID function is getting invoked so
> > I can get a better understanding. I didn't find anything.
>
> > I created the ftValidateKeywords in mysite/packages/types/course.cfc
>
> > I am at loss of how to now use my ftValidateKeywords function.
>
> > Thanks!
>

Ron Mast

unread,
Aug 16, 2010, 9:59:32 AM8/16/10
to farcr...@googlegroups.com
Hi Sean,

I understood everything but "I think there may be a bug in FarCry that


prevents the
<ft:serverSideValidation /> tag from firing. You may have to create
your own edit.cfm handler and manually add in a call to
<ft:serverSideValidation />. Hopefully someone from Daemon will chime
in a shed some light."

Can you explain this further...I'm trying to find an example and going
to scope out ft:serverSideValidation.

Again I am using .failed()

Thanks so much Sean!

Sean Coyne

unread,
Aug 16, 2010, 10:15:07 AM8/16/10
to farcry-dev
If you create a edit.cfm file in the webskin folder for a content
type, that will become the handler for editing records of that type.
So rather than use the built-in edit handler, you can specify your
own.

I believe, but I am not positive, that I remember someone mentioning a
bug in FarCry that prevents the server side validation from
executing. You could remedy this by writing your own edit handler and
forcing it to execute the server side validation.

For an example of a custom edit handler you can check out /core/
webskin/dmInclude/edit.cfm or /core/webskin/dmNavigation/edit.cfm or /
core/webskin/dmProfile/edit.cfm

Sean

On Aug 16, 9:59 am, Ron Mast <ron...@gmail.com> wrote:
> Hi Sean,
>
> I understood everything but "I think there may be a bug in FarCry that
> prevents the
> <ft:serverSideValidation /> tag from firing.  You may have to create
> your own edit.cfm handler and manually add in a call to
> <ft:serverSideValidation />.  Hopefully someone from Daemon will chime
> in a shed some light."
>
> Can you explain this further...I'm trying to find an example and going
> to scope out ft:serverSideValidation.
>
> Again I am using .failed()
>
> Thanks so much Sean!
>
>
>
> On Fri, Aug 13, 2010 at 2:40 PM, Sean Coyne <coyne.s...@gmail.com> wrote:
> > You should be creating your returns struct using the "passed" and
> > "failed" methods like farUser:
>
> > <cfset stResult = createObject("component",
> > application.formtools["field"].packagePath).failed(value="#arguments.stFiel dPost.value#",
Reply all
Reply to author
Forward
0 new messages