Am Donnerstag 15 März 2007 11:35 schrieb Carl Franks: > On 14/03/07, Mario Minati <[EMAIL PROTECTED]> wrote: > > Am Dienstag 13 März 2007 23:45 schrieben Sie: > > > As I understand the code, the place to generate a custom javascript for > > > the widget is in a custom render function, right? > > All field elements have a javascript() method. > Look in file "root/field" to see where it's used. > > We probably ought to have a javascript() method on form, too. > Maybe add a new issue for this on the project page? > http://code.google.com/p/html-formfu/issues/list
Has been filed, but due to a google code server problem I got the type wrong. It should be an enhancement. But it seems than I cannot change any entries. > > > My problem is now that I need the id of the widget to access it later > > > via javascript, but prepare_id has not been called yet in the render > > > function of Element.pm. > > > > > > Is it possible to call prepare_id before creating the render object or > > > would that mix something up? > > Now that we don't have the intermediate $result object, this is harder. > prepare_id() has to do it's work on the $render object, so that it > doesn't change the original form/field at all - which would cause > problems, if for example, you cloned the form and gave the new form a > different ID. The field would have a hard-coded ID, so auto_id() > wouldn't be used. > > > Ok I found out that changing the position is not possible. > > > > How to fix this? > > Is there a way to tell TT to double parse the content? This way we could > > use TT stuff inside the render function e.g. "[self.id]" to access the > > id. > > My first thought is that if you're needing access to the ID during > form creation, you probably ought to be setting that field's ID > explicitly. I did something else, which is something like a hack. I put the code in 'prepare_attrs' this way it works fine. Greets, Mario _______________________________________________ Html-widget mailing list Html-widget@lists.rawmode.org http://lists.rawmode.org/cgi-bin/mailman/listinfo/html-widget