[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.



[Proto-Scripty] How to make id added by ajaxUpdater visible to the rest of the page

2010-05-16 Thread Magnus Johnson
Hello,

I am using ajaxUpdater to allow the user to add an arbitrary number of
rows to a table. Then the user feeds in data into each field in the
table. This part works excellent. The problem I run into is when I
want to use ajax auto complete in in column 1 on each row in the
table. I am using the following tool for this:
http://freeajaxscripts.net/directory/Ajax_auto_complete/Gagandeep_Singh/details.html.

In a static table (not modified by ajaxUpdater) this also works
excellent. However when I add a new row to my table, the auto complete
does not work on the rows added by ajaxUpdater.

My code for the table looks like this:
echo form action=\$currentfile\ method=\get\ class=\asholder
\;
echo table id=\mytable\ class=\bluetable\;
echo trthColumn 1/ththColumn 2/th/tr;
echo tr id='row1'  td input type=\text\ name=\name[]\ id=
\testinput1\ value=\\ /td;
echo td input type=\text\ name=\amount[]\ value=\\ /td;
echo td a href=\\ onmousedown=
\ajaxUpdater('row1','change_row.php?remove')\ img src=\b_drop.png
\/ /a /td/tr;
echo /table;
echo /form;
And a button to add new rows to the table:
echo input type=\button\ value=\New row\ onClick=
\ajaxInserter('mytable','change_row.php?add')\;

When I add a new row by using the php script change_row.php I change
the id to testinput2, testinput3 and so on. This is the id that the
ajax auto complete triggers on, but it does not :-(.

I am quite stuck here so any help would be appreciated.

/Magnus

-- 
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.