Thursday 22 March 2007 2:28:59 am
Hi to you all.
Working with new classes and templates of my installation of ez 3.9rc1 I noted a strange thing.
I created a new class object for a form to compile.
Many of the attributes are Selection datatype type. I added options in this way:
1. Select from the list
2. Option a
3. Option b
4. Option c
and so on.
The problem is that the attribute is required, but with the line 1 if the user don't make a selection the object is stored anyway.
There is some trick to change this fact? Something like a template code block? Daniele Nocentini send me a personalized solution modifiying the template with th use of text string of this type:
{default attribute_base='ContentObjectAttribute'}
{let data_text=cond( is_set( $#collection_attributes[$attribute.id] ), $#collection_attributes[$attribute.id].data_text, $attribute.content )}
<select name="{$attribute_base}_ezstring_data_text_{$attribute.id}">
<option value="">Scegli...</option>
<option value="Roma" {section show=eq( $data_text|wash(xhtml), 'Roma')}selected{/section}>Roma</option>
<option value="Milano" {section show=eq( $data_text|wash(xhtml), 'Milano')}selected{/section}>Milano</option>
<option value="Torino" {section show=eq( $data_text|wash(xhtml), 'Torino')}selected{/section}>Torino</option>
</select>
{/let} {/default}
I'd like to know if there a official solution of the problem. Thanks in advance.
|