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.