paulmason411
Posts: 127
|
| Posted: 07/24/2008, 11:39 PM |
|
Hi Guys,
Basically what I want to do is use ajax to change a listboxB when you alter listboxA. I know that this can be achieved using dependent listboxes however the listboxes I use are generated by custom code and not from a datasource.
This is what I have tried:
I added an update panel around listboxB and in the Refresh option I ticked the onchange for listboxA.
As a test I tried printing the value of listboxA with the following code:
print $Container->listboxA->GetValue();
The problem is that the value doesn't change when you select a different option from listboxA.
Any help or suggestions would be appreciated. Cheers.
_________________
http://paulmason.name - Web Development Blog
|
 |
 |
wkempees
Posts: 1679
|
| Posted: 07/25/2008, 2:17 AM |
|
Just a quick remark:
The dependant listbox solution (especially CCT) will work on datasets as well as datasources.
The onchange action should generate a function of sorts, check code.
The function should have a parameter and return a parameter.
Test for that parameter not for $Container->listboxA->GetValue()
Walter
(not tested)
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
 |
 |
paulmason411
Posts: 127
|
| Posted: 07/29/2008, 11:34 PM |
|
I had a look and all I could find was some unfamiliar JavaScript that looked hard to edit.
To be more specific and hopefully break things down a bit more, I basically need to get the selected option id of listboxA without refreshing the page.
Any ideas?
_________________
http://paulmason.name - Web Development Blog
|
 |
 |
maxhugen
Posts: 272
|
| Posted: 07/30/2008, 7:12 PM |
|
The Dependent Listbox feature creates an ajax service. This service CCS page is probably in a folder called services.
Open the service you created. It should have a Grid control in it. Open the grid's data source. This must have a WHERE predicate such as "WHERE myField = {keyword}". It should have been created for you when using the Builder.
The ajax javascript function will send a Request to something like:
"services/myService.php?keyword=myListboxA_Value"
You can insert an alert in the javascript, just before the Request line, to check the value of your keyword, to make sure the Request is sending the parameter you're expecting , ie, the value of ListboxA.
HTH
_________________
Max
www.gardenloco.com | www.eipdna.com | www.chrisarminson.com |
 |
 |
|