Multiple forms using same xml and BO

22 views
Skip to first unread message

Lynn Ebanks

unread,
Dec 31, 2014, 11:33:32 AM12/31/14
to valida...@googlegroups.com
Hi John!

I hope you are having a nice holiday season!

I am working on a project that has an unusual database model.   This is a legacy app that could use a database redesign but that isn't happening for now : ) The tables are very large and there are multiple forms that interact with the same table, so we only want to validate the form fields specific to that form when the form is posted. 

To give a more clear example, the user table has about 100 fields or more in it (ouch!).   There are about 4 user forms where they add/update data that gets posted to this table.  I have one User.cfc that contains all of the fields in the database table and one user.xml file that has all of the form validation.  One form one, I only need to validate Name, address, phone, city state, for example.  So if I specify that those fields are to be validated in the "basic" context only, for example  is this the best approach?

I hope this makes sense!

TIA!

Jason Durham

unread,
Jan 1, 2015, 2:15:54 AM1/1/15
to valida...@googlegroups.com
This is essentially the purpose of a context.

Jason Durham

--
You received this message because you are subscribed to the Google Groups "ValidateThis" group.
To unsubscribe from this group and stop receiving emails from it, send an email to validatethis...@googlegroups.com.
To post to this group, send email to valida...@googlegroups.com.
Visit this group at http://groups.google.com/group/validatethis.
For more options, visit https://groups.google.com/d/optout.

John Whish

unread,
Jan 1, 2015, 9:58:19 AM1/1/15
to valida...@googlegroups.com
Yup - as Jason says - use the contexts. Using the example from the docs:

<property name="FirstName">
	<rule type="required" contexts="Profile" />
</property>

Here you are saying the "FirstName" property is only required for the "Profiles" context. You then do something like

<cfset Result = application.ValidateThis.validate(myObject,'User','Register') />
HTH and Happy New Year.

John



Lynn Ebanks

unread,
Jan 2, 2015, 1:19:43 PM1/2/15
to valida...@googlegroups.com
Thank you so much!  Great to get confirmation from the expert!

Happy New Year to you too!!!!

Lynn Ebanks

unread,
Jan 2, 2015, 1:20:05 PM1/2/15
to valida...@googlegroups.com, ja...@durhamcons.com
Thanks Jason!  I appreciate your help!!
Reply all
Reply to author
Forward
0 new messages