datatype ezselection impossible to made required

Author Message

christian bencivenni

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.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 20:52:17
Script start
Timing: Jan 18 2025 20:52:17
Module start 'layout'
Timing: Jan 18 2025 20:52:17
Module start 'content'
Timing: Jan 18 2025 20:52:17
Module end 'content'
Timing: Jan 18 2025 20:52:17
Script end

Main resources:

Total runtime0.6825 sec
Peak memory usage4,096.0000 KB
Database Queries46

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0061 588.0625152.6406
Module start 'layout' 0.00620.0051 740.703139.4766
Module start 'content' 0.01120.6701 780.1797409.7500
Module end 'content' 0.68130.0012 1,189.92978.2813
Script end 0.6825  1,198.2109 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.5131160.0002
Check MTime0.00140.2042160.0001
Mysql Total
Database connection0.00100.141810.0010
Mysqli_queries0.640493.8383460.0139
Looping result0.00040.0605440.0000
Template Total0.647894.920.3239
Template load0.00220.329220.0011
Template processing0.645594.584520.3228
Template load and register function0.00010.021810.0001
states
state_id_array0.00210.313110.0021
state_identifier_array0.00160.231220.0008
Override
Cache load0.00190.2784280.0001
Sytem overhead
Fetch class attribute can translate value0.00050.079310.0005
Fetch class attribute name0.00080.122910.0008
XML
Image XML parsing0.00010.017610.0001
class_abstraction
Instantiating content class attribute0.00000.000710.0000
General
dbfile0.00070.1003100.0001
String conversion0.00000.001640.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
1content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
3content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 9
 Number of unique templates used: 5

Time used to render debug report: 0.0001 secs