Well, you basically have two choices: pull or push. --- Pull: Set up a pull tool (detailed instructions are at http://jakarta.apache.org/turbine/turbine-2.3/howto/pullmodel-howto.html), and call it helpTool or something and point it to the HelpTool class. In the HelpTool class, have a method getHelpMessage(String fieldName) which does an if statement on the field name to return the appropriate help text. Call the method of the tool from thee .vm file: <img src="blah.jpg" alt="$helpTool.getHelpMessage("FieldName")"> --- Push: Populate the context of the page with every help item for the page, and use them. For example, a page called FillMe.vm with fields Name and Job would have a java class called FillMe which would populate the context [in doBuildTemplate() $context.Add("NameHelp", "Enter your name") $context.Add("JobHelp", "Send your resume")] and then in FillMe.vm <img src="blah.jpg" alt="$NameHelp"> and <img src="blah.jpg" alt="$JobHelp"> ---
The pull tool is better since you have only one class for every screen but worse since every field that gets a help text needs to be in here, the push tool is better because it allows you to separate the screens/fields sensibly but is worse since if you move fields between screens you have to move their help text. Either way should work, though. Good luck, David Demner -----Original Message----- From: Gaasch, Derek [mailto:[EMAIL PROTECTED] Sent: Friday, January 30, 2004 2:10 PM To: 'Turbine Users List' Subject: RE: add custom attribute to intake field ? Thanks for the thoughts, Daniel. I never said it was a validation thing... just as $intakeObject.Title isn't a validation thing. It gives some explanation to the user as to what they are supposed to enter into the form field. Since this property is always tied to the form field, a logical place to populate it (it seems to me) would be in the intake.xml file (which defines more than just validation rules). I'd be happy to do it somewhere else, although I'm not sure I can think of a straightforward and logical place to do it. I'm not sure I get what you envision. What exactly is $myobj? How do I tie it to a specific intake form type? -d -----Original Message----- From: Daniel [mailto:[EMAIL PROTECTED] Sent: Thursday, January 29, 2004 1:28 PM To: Turbine Users List Subject: Re: add custom attribute to intake field ? Hi, Haven't done this, but just thinking, isn't what you're trying to do really is a presentation issue and not a validation thing? How about making your "form object" in the template have properties that return specialized html (e.g. tool tip or whatever)... Say for example, in mytemplate.vm: $myobj.ToolTip And how you populate the object's properties is up to you... Just my 2 cents. Regards, Daniel On Wed, 28 Jan 2004, Gaasch, Derek wrote: > > Has anyone out there customized Intake by adding an attribute to a field > element? I would like field elements to have an optional attribute that > contains "help text". The use of this would be (for example) so that when an > intake form is displayed, each field with associated helptext will display a > small img whose alt=helptext. So when a user mouse-overs the help image, the > help text is displayed. I had hoped that the intake code would just pick up > extra attributes in the xml, but it seems like this is not the case. Anyone > have a suggestion of how to do this? > > Thanks, > derek > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
