[Plone-UI] Using "extra_top" slot override in an AT type's xxx_yy_edit

Mastro, James JAMES.MASTRO at saic.com
Sun Jun 4 20:48:40 UTC 2006


I've created an xxx_yy_edit PT so that my AT type will automatically look to
process from this page first.
 
In my xxx_yy_edit page I have only the following:
 
        <metal:use define-macro="body">
            <metal:default_body use-macro="here/edit_macros/macros/body">
                <metal:block fill-slot="extra_top">

In other words, I only want to override "extra_top" from edit_macros.
 
In my "extra_top", I want to add <form> sub-elements such as <select>.
Based on the changing of the <select> value (onchange), I want to submit()
the form.  I presume that the form is named "edit_form" (from edit_macros)
and there's only one, so I have code something like:
 
<select name="yadda"
            onchange="submitPage(); return false;" 
 
and 
 
<script>
    function submitPage()
    {  
        var edit_form = document.forms['edit_form'];
        edit_form.submit();
    }
</script>
 
In IE, get the error:  "Object doesn't support this property or method" on
the submit() line.  In FireFox I get something similar.
 
I've looked into the "edit_form" class attribute
(class="enableUnloadProtection"), but am unsure of exactly what it does, but
get the feeling it's my problem.
 
I've thought about re-setting the "class" attribute of edit_form.  
 
I don't want to provide a "submit" button.  However, when I have during
testing, the I do not return to the xxx_yy_edit page, but the view page
(with the message "Changes Saved.".  
 
Also I *do* want to create a round-trip to the server with the "onchange"
since there's a lot of method calling done by <tal> on the re-load.  If I
had to put my logic in JS, it'd be possible, but ugly.
 
Also possible is overriding the whole "body" macro in edit_macros, but
that's not elegant either (too big of a hammer).
 
Can someone explain what is happening here, and if they've come up with a
workaround?  
 
TIA,
Jim
 



More information about the UI mailing list