properties in form elements

Author Message

Felix Leimbach

Tuesday 16 January 2007 11:49:35 am

Hello everyone,

Want to confirm an issue before posting a bugreport:
In my information collection forms I'm displaying the class attributes with {attribute_edit_gui}. Those get rendered to <input>, <select>, <textareas> just fine.
Now I want to add attributes like size="10" and javascript events like "onchange=do_something()".

Upon looking in the standard templates I found, that none of the numerous available HTML attributes are supported by the templates.
So how do you eZP users render those elements if you want any of those attributes?

One way is to put the HTML directly in the template instead of using {attribute_edit_gui} but that's ugly IMHO.
So I went ahead and overrode various templates in content/datatype/edit to recognize javascript events and other attributes.

Here's a example of ezstring.tpl enriched with size, maxlength and onkeyup support:

{default attribute_base='ContentObjectAttribute'
         html_class='full'
	 size=false()
         maxlength=false()
         onkeyup=false()}
<input id="ezcoa-{if ne( $attribute_base, 'ContentObjectAttribute' )}{$attribute_base}-{/if}{$attribute.contentclassattribute_id}_{$attribute.contentclass_attribute_identifier}" class="{eq( $html_class, 'half' )|choose( 'box', 'halfbox' )} ezcc-{$attribute.object.content_class.identifier} ezcca-{$attribute.object.content_class.identifier}_{$attribute.contentclass_attribute_identifier}" type="text" {if $size}size="{$size}" {/if}{if $maxlength}maxlength="{$maxlength}" {/if}{if $onkeyup}onkeyup="{onkeyup}"  {/if}name="{$attribute_base}_ezstring_data_text_{$attribute.id}" value="{$attribute.data_text|wash( xhtml )}" />
{/default}

Anyone knows of a solution that doesn't require patching eZP?

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 19:30:54
Script start
Timing: Jan 18 2025 19:30:54
Module start 'layout'
Timing: Jan 18 2025 19:30:54
Module start 'content'
Timing: Jan 18 2025 19:30:55
Module end 'content'
Timing: Jan 18 2025 19:30:55
Script end

Main resources:

Total runtime0.6922 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.0062 587.9141152.6250
Module start 'layout' 0.00620.0031 740.539139.4453
Module start 'content' 0.00930.6815 779.9844410.5938
Module end 'content' 0.69080.0013 1,190.57818.1641
Script end 0.6921  1,198.7422 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00370.5334160.0002
Check MTime0.00140.2045160.0001
Mysql Total
Database connection0.00080.115410.0008
Mysqli_queries0.653594.4151460.0142
Looping result0.00040.0613440.0000
Template Total0.658995.220.3294
Template load0.00210.298220.0010
Template processing0.656894.889020.3284
Template load and register function0.00020.023710.0002
states
state_id_array0.00170.238510.0017
state_identifier_array0.00080.116920.0004
Override
Cache load0.00170.2431140.0001
Sytem overhead
Fetch class attribute can translate value0.00090.124110.0009
Fetch class attribute name0.00050.074010.0005
XML
Image XML parsing0.00010.016310.0001
class_abstraction
Instantiating content class attribute0.00000.000410.0000
General
dbfile0.00070.0958100.0001
String conversion0.00000.001340.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
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 12
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs