Hi all,

I have a mixin that watches for zone updates.
This mixin is set up on a submit button for a form.
I cannot fund a way to make the mixin fetch the zone from an underlying form.
So, as a workaround I am forced to specify the same zone twice.  Any hints
on how I can get the zone inside the mixin from the underlying form?

 <form t:type="form" zone="myZone">
        <h1>Press 
        <button t:type="submit" value="Here" event="doThis" 
t:mixins="DisableAfterSubmit" zone="myZone"> !!! I DO NOT WANT TO SPECIFY SAME 
ZONE TWICE
          <t:remove>Here</t:remove>
        </button>
        to Do this!</h1>
  </form>


Thanks!

--------------------------

@Import(library="context:scripts/DisableAfterSubmit.js")
public class DisableAfterSubmit
{
    @AfterRender
    void addDisabler()
    {
        js.addScript("new DisableAfterSubmit('%s', '%s', '%s');",
                submitButton.getClientId(), fs.getClientId(), zone);
    }
    
    
    @Environmental private JavaScriptSupport js;
    @InjectContainer private ClientElement submitButton;
    @Environmental private FormSupport fs;
    @Parameter(required=true, defaultPrefix=BindingConstants.LITERAL) private 
String zone;
}
--------------------------------

/**
 * Disable Submit button after AJAX Form Submission
 */

var DisableAfterSubmit = Class.create();
DisableAfterSubmit.prototype = {
                initialize: function(elementId, formId, zoneId) {
                        this.formId = formId;
                        this.elementId = elementId;
                        this.zoneId = zoneId;

                        Event.observe($(elementId), 'click',
                                        
this.doDisable.bindAsEventListener(this));
                        
                        Event.observe($(zoneId), Tapestry.ZONE_UPDATED_EVENT,
                                        
this.doEnable.bindAsEventListener(this));
                },

                doDisable: function(e) {
                        $(this.elementId).disable();
                        $(this.formId).onsubmit();
                },
                
                doEnable: function(e) {
                        $(this.elementId).enable();
                }
};



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to