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.

eZ debug

Timing: Jan 18 2025 22:31:11
Script start
Timing: Jan 18 2025 22:31:11
Module start 'layout'
Timing: Jan 18 2025 22:31:11
Module start 'content'
Timing: Jan 18 2025 22:31:12
Module end 'content'
Timing: Jan 18 2025 22:31:12
Script end

Main resources:

Total runtime0.5972 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0044 588.1563152.6563
Module start 'layout' 0.00440.0031 740.812539.5078
Module start 'content' 0.00760.5881 780.3203493.3203
Module end 'content' 0.59570.0015 1,273.640612.1094
Script end 0.5972  1,285.7500 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00370.6114160.0002
Check MTime0.00160.2636160.0001
Mysql Total
Database connection0.00060.092410.0006
Mysqli_queries0.548691.8596540.0102
Looping result0.00060.1044520.0000
Template Total0.569395.320.2847
Template load0.00210.343820.0010
Template processing0.567394.984720.2836
Template load and register function0.00020.036210.0002
states
state_id_array0.00080.137710.0008
state_identifier_array0.00070.119220.0004
Override
Cache load0.00180.3061170.0001
Sytem overhead
Fetch class attribute can translate value0.00130.211320.0006
Fetch class attribute name0.00110.184520.0006
XML
Image XML parsing0.00030.048520.0001
class_abstraction
Instantiating content class attribute0.00000.001520.0000
General
dbfile0.00060.1046100.0001
String conversion0.00000.001440.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
2content/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: 13
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs