MasterSelectWidget does not like ReferenceWidget?
"suresh vv" <[email protected]>
| Newsgroups | gmane.comp.web.zope.plone.archetypes.devel |
|---|---|
| Message-ID | <[email protected]> |
I am trying to use MasterSelectWidget where the "slave" (can we rename this
to dependent please?) field is a ReferenceField and encountered the
following problem.
1. When I use SelectionWidget, selection.pt calls displayValue() with vocab
and value as the actual object referenced (instead of an UID) which causes
an exception in __getitem__ in BaseObject that says 'int' has no attribute
'startswith' (since __getitem__
seems to want a string as key always).
2. So I changed SelectionWidget to ReferenceWidget but modifySelectList.js
had some objections. To make everone happy I had to make the following
changes
to reference.pt in Archetypes and modifySelectList.js
Changes were as follows:
modifySelectList.js: Enable support for list fields
< if (typeof(slave_field)=="undefined") { alert("Slave field
"+element_id+" could not be found in the form "+form_name); return;}
---
> if (typeof(slave_field)=="undefined") {
slave_field = cur_form[element_id+":list"];
if (typeof(slave_field)=="undefined") { alert("Slave field
"+element_id+" could not be found in the form "+form_name); return;}
}
reference.pt: Enable support for widget.format just like SelectionWidget
< <div tal:condition="python:vlen <=
widget.checkbox_bound">
---
> <div tal:condition="python:vlen <= widget.checkbox_bound and
>widget.format != 'select' ">
< <div tal:condition="python:vlen > widget.checkbox_bound">
---
> <div tal:condition="python:vlen > widget.checkbox_bound or
>widget.format == 'select' ">
Can these changes be fed back into svn?
Suresh
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click