Welcome Guest, Not a member yet? Register   Sign In
Help with listbox.
#1

[eluser]basty_dread[/eluser]
Hi to all.

I am here again to ask for your help.,.

This is not a about CI. but i am using CI to make my project..

This is about javascript..

i have a listbox:
___________ Title:
|One 1..............| [ One..... ] <-- this is a textbox
|Two 2.............| Content:
|Three 3..........| [One 1..... ] <-- this is a textbox
|Four 4............|
|Five 5.............| [SAVE] [PREV][NEXT] <-- this are buttons
|___________|

on first load of the page the word One 1 on the listbox is selected.
Do you know a script that when i Click Next or prev it will move to the next selection on the listbox i Mean Two 2 will be higlighted next..? any idea??

Please help me..
I hope you understand guys what i am trying to say.
thank you very much for the help
#2

[eluser]Ben Edmunds[/eluser]
Check out http://www.simonholywell.com/computing/i...lists.html

This example isn't exactly what you want but I think jQuery's .after will do what you need.
#3

[eluser]theprodigy[/eluser]
the javascript property you are looking for is selectedIndex.

You want to do something similar to:
For Previous:
Code:
document.getElementById("DropDownList1").selectedIndex -= 1;
and for Next:
Code:
document.getElementById("DropDownList1").selectedIndex += 1;

You will want to do some validation to make sure that those indexes exist prior to calling this code.

Put these into functions, and call the functions in the Prev and Next onclick attributes
#4

[eluser]basty_dread[/eluser]
hi theprodigy.. how can i Post the selected value on the listbox?
i tried this on my listbox..

Code:
<select class="selects" id="selection" name="selection">

but it is not submitting..
#5

[eluser]theprodigy[/eluser]
if your select is inside a form tag, and your Save button is a input type="submit", then your select should get posted.

Please post your view so that we can look at it. It will be much easier to help.
#6

[eluser]basty_dread[/eluser]
<select class="selects" id="selection" name="selection" size="38" style="width:290px; font-size:10px">

this dot form dot submit is not working?
#7

[eluser]basty_dread[/eluser]
ok now i got it.. thanks theprodigy.. thanks a lot
#8

[eluser]theprodigy[/eluser]
Please the code in the view file that you are rendering so that we can see the entire thing (and please place it in the code tags).

It's much easier to know what is happening when we can see the entire code.

EDIT: disregard. Didn't see your last reply.




Theme © iAndrew 2016 - Forum software by © MyBB