[Proto-Scripty] .Observe, .stopObserving and .reset - using all together.

2010-05-16 Thread Chris Petersburg
I've been banging my head trying to figure this out (and yes reading
all the documentation).

What I want to do is:

1. Set an observer for multiple forms which enables a set of buttons
2.. When the reset button is clicked:
2a.Stop the current .Observer event associated with the current form
2b. .reset() the form to it's original state
2c. Hide the submit and reset buttons
2d. re-invoke the observer for the form.

Here is what I have:

Step 1: Set the observer for all the page forms [this works fine -
forms are named frma, frmb, ...]

document.observe('dom:loaded',function(){
$$('form').each(function(e) {
new Form.Observer(e, 0.3, function(form){
var buttons = e.getInputs('button');
buttons.invoke('show');
});
});
});

Step 2: This is where my code has a hicup, I need assistance
using .stopObserving.  What am I missing?

input type=button class=button value=Cancel id=btncancela
name=btncancela onClick=LocalCancel('a');

function LocalCancel(tab){
Event.stopObserving('frm'+tab); // - throws error
$('btncreate'+tab).hide();$('btncancel'+tab).hide();
$('frm'+tab).reset();
//How to reset observer for this form here?
};

-- 
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.



RE: [Proto-Scripty] .Observe, .stopObserving and .reset - using all together.

2010-05-16 Thread Jonathan Rosenberg
Regarding this statement

Event.stopObserving('frm'+tab); // - throws error

Does each form have an id attribute with value 'frma', ...?  Or just a
name attribute, as your note says?

--
Jonathan Rosenberg
Founder  Executive Director
Tabby's Place
http://www.tabbysplace.org


-Original Message-
From: prototype-scriptaculous@googlegroups.com
[mailto:prototype-scriptacul...@googlegroups.com] On Behalf Of Chris
Petersburg
Sent: Saturday, May 15, 2010 2:47 AM
To: Prototype  script.aculo.us
Subject: [Proto-Scripty] .Observe, .stopObserving and .reset - using all
together.


I've been banging my head trying to figure this out (and yes reading
all the documentation).

What I want to do is:

1. Set an observer for multiple forms which enables a set of buttons
2.. When the reset button is clicked:
2a.Stop the current .Observer event associated with the current form
2b. .reset() the form to it's original state
2c. Hide the submit and reset buttons
2d. re-invoke the observer for the form.

Here is what I have:

Step 1: Set the observer for all the page forms [this works fine -
forms are named frma, frmb, ...]

document.observe('dom:loaded',function(){
$$('form').each(function(e) {
new Form.Observer(e, 0.3, function(form){
var buttons = e.getInputs('button');
buttons.invoke('show');
});
});
});

Step 2: This is where my code has a hicup, I need assistance
using .stopObserving.  What am I missing?

input type=button class=button value=Cancel id=btncancela
name=btncancela onClick=LocalCancel('a');

function LocalCancel(tab){
Event.stopObserving('frm'+tab); // - throws error
$('btncreate'+tab).hide();$('btncancel'+tab).hide();
$('frm'+tab).reset();
//How to reset observer for this form here?
};

-- 
You received this message because you are subscribed to the Google Groups
Prototype  script.aculo.us group.
To post to this group, send email to
prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.