[Proto-Scripty] Re: Behavioral of select option

2010-12-23 Thread Neaox
Hi

I think the error might be to do with this section of code:

...).down('input.previous')...

this is calling for the first input with a class name of 'previous'
within the element with the id of 'paging', what I'm assuming you were
trying to do was get the element that comes before the first input in
the element with the id of 'paging' if so the following should work:

$('paging').down('input').previous().observe('click',
_msoS.handlePagingSubmit.bindAsEventListener(_msoS, $F('myselect')));


If not, could you post the entirety of your code including your HTML?
Then perhaps I may be of more help.

Cheers,

Chris


On Dec 23, 10:57 am, kstubs kst...@gmail.com wrote:
 I have a select option, in HTML It is empty like this:

 select id=myselect name=selectoroption//select

 After page load I make ajax request and finish loading the selector with
 additional option(s).

 So I might have:
 select id=myselect name=selector
   option1/option
   option2/option
   option3/option
 /select

 I have registered an event to handle a submit click for the form and pass
 the value to the click handler event like this:

 $('paging').down('input.previous').observe('click',
 _msoS.handlePagingSubmit.bindAsEventListener(_msoS, $F('myselect')));

 The value passed to my click handler for myselect is NULL but indeed the
 first option is selected.

 Whats wrong?

-- 
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] Re: Behavioral of select option

2010-12-23 Thread ColinFine


On Dec 22, 9:57 pm, kstubs kst...@gmail.com wrote:
 I have a select option, in HTML It is empty like this:

 select id=myselect name=selectoroption//select

 After page load I make ajax request and finish loading the selector with
 additional option(s).

 So I might have:
 select id=myselect name=selector
   option1/option
   option2/option
   option3/option
 /select

 I have registered an event to handle a submit click for the form and pass
 the value to the click handler event like this:

 $('paging').down('input.previous').observe('click',
 _msoS.handlePagingSubmit.bindAsEventListener(_msoS, $F('myselect')));

 The value passed to my click handler for myselect is NULL but indeed the
 first option is selected.

You haven't said how the first option is selected (whether by the
user, or by the initial Ajax load); but I think the problem might be
that with some browsers if you populate a select by Javascript it is
not enough to have one or more of the options 'selected': you need
to tell the select explicitly what is selected.

-- 
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] Re: Behavioral of select option

2010-12-23 Thread kstubs
Chris, the selector is valid, I have an input with a class=previous within 
a form container id=paging
Colin, after the select option list is dynamically constructed I set the 
first item in the list like this:
pagePageSelector.options.selectedIndex = (currentpage - 1);
I've stepped through the code at this point and there is no issue here, 
currentpage has value and -1 this value is 0 or greater.

After additional study I have learned that there was conflicting events on 
document:load that meant certain assigned event handler bindings invalid.  I 
have moved these binding scripts into later event handled scripts.

Thanks for the help.  Issue solved.
Karl..

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