Hi guys,
I am new to prototype as a result the following is a simple question
please help me out as i have stucked on this for 2 hours (searching,
trying, googling and etc)
var td6Input = td6.appendChild(new Element(''input'', {size:
"2",
maxLength: "2", name: "txtDateOfServDay"+seq, id:
"txtDateOfServDay"+seq, onkeyup: "KeyButtonPress(this, event,
2)",
onchange: "checkDay(this)"}));
the onkeyup will call my KeyButtonPress function but somehow at this
case it doesn''t seem working.
did i get the syntax incorrect?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
I''m not sure what you want "this" to be (in callbacks), but
something
like is what you might consider:
var td6Input = $(td6).insert(
new Element(''input'', {
size: 2,
maxLength: 2,
name: "txtDateOfServDay" + seq,
id: "txtDateOfServDay" + seq
}).observe(''keyup'', function(){ KeyButtonPress(this, event,
2) })
.observe(''change'', function(){ checkDay(this) })
)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
hi kangax,
thanks for the help it really save me a lot of time ..
unfortunately i have more problem from using observe ...
it is because the design of my current work.
which is a very very dynamic page
eg
observe(''focus'',
function(){highlight("indicator1"+topPatCnt)})
topPatCnt is a incrementing number which keep increase once the
dynamic form get added.
highlight is a function which highlights the filed once the cell is
clicked
from my experience so far correct me if i am wrong, observe runs like
real time, it calls highlight function on-the-fly once the cell is
clicked.
as a result it always highlights the last topPatCnt form
that is if you have form A, B, C, D and E
if you click on the cell in form B it insteads of highlighting cell in
form B it highlights cell in form E because topPatCnt is 5
is there any prototype to fix my issue?
do you get my problem? let me know if you need more information as it
took a while for me to explain the problem to my manager as well.
thanks in advance.
On Nov 20, 4:35 pm, kangax
<kan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> I''m not sure what you want "this" to be (in callbacks),
but something
> like is what you might consider:
>
> var td6Input = $(td6).insert(
> new Element(''input'', {
> size: 2,
> maxLength: 2,
> name: "txtDateOfServDay" + seq,
> id: "txtDateOfServDay" + seq
> }).observe(''keyup'', function(){ KeyButtonPress(this,
event, 2) })
> .observe(''change'', function(){ checkDay(this) })
> )
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
Ah... Last element issue sounds familiar... Could you paste that chunk of code where you increment topPatCnt? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
function add() {
topPatCnt = topPatCnt + 1;
...
...
...
var td1 = new Element(...........).observe(''focus'',
function()
{highlight("indicator1"+topPatCnt)});
...
...
...
}
something like this ...
so at the frontend when you click the button which trigger add()
function, extra dynamic form
On 12月3日, 下午5時54分, kangax <kan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Ah...
> Last element issue sounds familiar...
> Could you paste that chunk of code where you increment topPatCnt?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---