Re: [ZIZope] [Plone 2.5.x] select HTML dipendenti
Yuri <[email protected]> Wed, 02 Jan 2008 16:00:57 +0100
| Newsgroups | gmane.comp.web.zope.italian |
|---|---|
| Message-ID | <[email protected]> |
moaiamorfo wrote:
> salve a tutti,
>
> sotto Plone 2.5.5, in un page template ho un menu a tendina (un comune
> elemento HTML select), che viene popolato da un vocabolario
> ATVocabularyManager.
> come posso fare in modo che, alla selezione di una voce da tale menu,
> venga riempito un secondo elemento select presente nella pagina?
> ovviamente, il contenuto di questo secondo select deve essere
> associato a quanto selezionato nel primo.
>
javascript? Anche se questo ti costringe a caricare tutto...
> in PHP avrei ricaricato la pagina alla prima selezione e avrei
> generato il contenuto della seconda select sulla base del valore
> selezionato, recuperato tramite GET.
>
devi personalizzare atct_edit oppure (molto meglio) creare un widget
apposito che legga il contenuto del campo e regoli il suo valore in
funzione del valore letto.
Creare un widget è semplicissimo, basta copiarne uno e modificarlo.
Oppure usi questo che fa esattamente quello che vuoi tu (almeno per un
livello, se hai più combinazioni sviluppane uno tuo), però attenzione
che utilizza javascript.
http://plone.org/products/masterselectwidget/
An Archetypes widget that looks like a normal select widget, but has the
ability to control the display and vocabulary of other fields in the schema.
Project Description
Master Select Widget is an Archetypes widget which looks and feels like
a normal select dropdown; however, any time an item is selected it
triggers javascript events which control the behavior of other fields in
the schema. It can hide other fields using CSS, disable other widgets,
and alter the vocabulary of other fields using XMLHttpRequest calls to a
methods that produce AT DisplayLists (the subordinate fields must use
Select, MultiSelect, or MasterSelect widgets).
You may have many of these 'master' widgets on a page and each can
control multiple 'slave' fields. The 'slave' fields themselves can use
'master' widgets controlling their own 'slaves'. Currently a 'master'
can only control one aspect (vocabulary, visibility. etc.) for each of
its slaves, but multiple 'masters' can control the same 'slave'. This
behavior is subject to change.
For more details look at the README.txt in the product directory, and
try the included demo type.
> grazie mille. :)
>
> saluti
>
>