You are on the right track. Informal parameters are the way to go.
You can specify informal parameters as using <binding> (or <static-binding>, etc.) in the component specification (being able to do so in the HTML template is a convienience that came later). Since you can use bindings, you can get the value from a method. I typically will let the ValidField render normally, then feed the field into a Script that generates appropriate client-side JavaScript, including initialzation to hook the field's onWhatever handler to a JavaScript function. You can see examples of this as the Publisher.script used in the Vlib demo. The script takes two components (a PropertySelection and a TextField) and creates client- side behavior to enable the TextField only when the PropertySelection (which renders as a <select>) is empty. The trick to client-side scripting is that you don't know the client-side name for your form elements until after they have rendered (names are doled out dynamically, which ensures they are unique even when used inside a Foreach or ListEdit). -- [EMAIL PROTECTED] http://tapestry.sf.net > Hello All! > > I'm new to Tapestry, and I'm trying to figure out if our company can use it > to replace our jsp-based system. So far it looks very promising, but now > I've run into the wall. > > I'm trying to subclass an existing component, ValidField, to be able to add > custom attributes to it (javascript event handler). I've looked into > overriding the renderComponent() function and adding the attributes, but > that can't be done, tapestry is complaining about not being able to write to > a closed tag. > > As it is now, I'm using informal parameters, but that's not really an > option, because I want to supply the attribute in the java class, not in the > html file. > > Can anyone help me out? > > regards, > > Niklas Ekman > ------------------------------------------------------- This sf.net email is sponsored by: OSDN - Tired of that same old cell phone? Get a new here for FREE! https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390 _______________________________________________ Tapestry-developer mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/tapestry-developer
