[Erp5-dev] dynamic form fields - how to do?

Jacek Medrzycki jacek at erp5.pl
Fri Mar 9 11:56:14 CET 2007


Hi

I have the following problem:

There is a field in the form, say "Recruitment type", which is a 
listfield with 2 values:
External
Internal
(this is associated with recruitment_type property)

Then, I have RelationStringField (for referral relation) that should, 
when clicked on the gear wheel:
a) In Internal recruitment type, display a list of Persons,
b) In External recruitment type, display a list of Announcements.

It is easy to write a TALES expression in "Portal Type" field, that 
makes relation string field display only Persons or Announcements, 
according to recruitment_type. It works good after initial load of the form.

But then, user can change the value on a Recruitment Type list field. In 
such a case, relation string, when clicked on gear wheel, would display 
wrong portal type.
I've attached javascript method to the list field: 
onchange='form.submit()', so the form is reloaded when user changes 
value in list field.
But then I've found out that my TALES expression is not re-evaluated 
after form is reloaded, so the releation string field is still 
associated with wrong portal type.

The question is - what should I do to make TALES re-evaluate after form 
is reloaded? Definitely there is such a way, 'couse TALESes are 
evaluated after user click gear wheel and then click "Update relation". 
I need similar behaviour for list field.

Regards,
Jacek



More information about the Erp5-dev mailing list