[Erp5-dev] proposal: JS-driven ParallelListField - and validator problem

bartek bartek at erp5.pl
Wed Mar 12 12:12:12 CET 2008


Hello

I started working on improving the ParallelListField (in it's 
multi-dropdown form). I think that it would be nice if it were 
JavaScript-driven, so that the dropdowns are added and removed 
immediately without reloading the page. It would speed up the work on 
the user side, and save a bit on server resources.

The JavaScript part is easy - I drafted come code which can be put in 
the "extra" field (onchange="refreshParallelListField(this)") and it 
does the job on the user side (the code is really dirty, so I'm rather 
reluctant to show it here...).

The problem is on the server side: if you add more then one value to the 
list, only the first one is saved. The problem is in 
ParallelListField.validate: it uses the hash script to generate a list 
of fields and then get values from the request; since the hash script 
returns the old list of values plus one, if there is more values in the 
request they are simply ignored.

The question is, what is the acceptable solution to this problem? The 
quick hack would be to scan the request for matching items which did not 
go through validation, process them and add to the result, but I'm not 
sure this is a good way to go. Any advice/guidance would be most welcome.

Bartek


-- 
"feelings affect productivity. (...) unhappy people write worse 
software, and less of it."
Karl Fogel, "Producing Open Source Software"



More information about the Erp5-dev mailing list