Adding Javascript call to a attribute_edit_gui object

Author Message

Jim Munz

Tuesday 23 May 2006 2:25:08 pm

Hello All,

I need to add a javascript function to a select input field in a form which is currently generated using attribute_edit_gui. Is there anyway to pass this function into this template function as a parameter? If so, an example would be very much appreciated.

thanks in advance!

Marcin Drozd

Friday 26 May 2006 2:19:09 am

Hello Jim
it is possible :)

interesting files:
design/standard/templates/content/edit_attribute.tpl
design/standard/templates/content/edit.tpl
design/standard/templates/content/datatype/edit/*.tpl (ezselection.tpl)

ex. override content/edit.tpl (my_edit.tpl)
type in

<form name="editform" id="editform" enctype="multipart/form-data" method="post" action={concat( '/content/edit/', $object.id, '/', $edit_version, '/', $edit_language|not|choose( concat( $edit_language, '/' ), '/' ), $is_translating_content|not|choose( concat( $from_language, '/' ), '' ) )|ezurl}>
    {include uri="design:content/edit_validation.tpl"}
        <input type="hidden" name="MainNodeID" value="{$main_node_id}" />

{default attribute_base='ContentObjectAttribute'}
<input type="hidden" name="ContentObjectAttribute_id[]" value="{$attribute_base}_ezstring_data_text_{$object.data_map.ATTRIBUTE_NAME.id}" />
<select ON_ACTION=JAVASCRIPT size="1" name="{$attribute_base}_ezstring_data_text_{$object.data_map.ATTRIBUTE_NAME.id}">
 <option value="VALUE1">NAME1</option>
 <option value="VALUE2">NAME2</option>
 <option value="VALUE3">NAME3</option>
</select>
{/default}

        <div class="buttonblock">
            <input class="defaultbutton" type="submit" name="PublishButton" value="{'Send for publishing'|i18n('design/base')}" />
            <input class="button" type="submit" name="DiscardButton" value="{'Discard'|i18n('design/base')}" />
            <input type="hidden" name="DiscardConfirm" value="0" />
            <input type="hidden" name="RedirectURIAfterPublish" value="{ezhttp( 'LastAccessesURI', 'session' )}" />
            <input type="hidden" name="RedirectIfDiscarded" value="{ezhttp( 'LastAccessesURI', 'session' )}" />
        </div>
</form>

or override content/datatype/edit/ezselection.tpl for select field (with your parameters).

http://ez-publish.pl

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