Open Source & Stuff  
  |     Main Site     |      Forum     |     Contact     |
Ajax Linked Select boxes :  forum.Salix.gr forum.Salix.gr
Comments, questions, usage, bugs. 
Goto Thread: PreviousNext
Goto: Forum ListMessage ListNew TopicSearchLog In
messageonChange editing textarea
Posted by: moonwalker (IP Logged)
Date: May 22, 2007 08:52AM

Hi all,

I'm facing a little problem. I'm using the following code:

=============================================================
=============================================================
$sc_ajax_select_boxes = new sc_ajax_select_boxes();
$sc_ajax_select_boxes->add_select_box('genre','genre_id','genre','genre_id','','genre','genre','');
$sc_ajax_select_boxes->add_select_box('singers','singer_id','name','singer_id','','singer','singer','');
$sc_ajax_select_boxes->add_select_box('albums','albums_id','title','albums_id','','album','album','');
$sc_ajax_select_boxes->add_select_box('songs','songs_id','name','songs_id','','songs','songs','');
$sc_ajax_select_boxes->link_select_boxes('genre','singer', 'genre_id','');
$sc_ajax_select_boxes->link_select_boxes('singer','album', 'singer_id','');
$sc_ajax_select_boxes->link_select_boxes('album','songs','albums_id','');
$sc_ajax_select_boxes->place_jscripts();
echo "<label for='genre'>Genre:</label>";
$sc_ajax_select_boxes->show_select_box('genre');
echo "<br /><label for='singer'>Singer:</label></p>";
$sc_ajax_select_boxes->show_select_box('singer');
echo "<br /><label for='album'>Album:</label>";
$sc_ajax_select_boxes->show_select_box('album');
echo "<br /><label for='songs'>Song:</label>";
$sc_ajax_select_boxes->show_select_box('songs');
===============================================================
===============================================================

It works great when I'm adding things to the database. But in my CMS system I would like to edit the lyrics of the songs. I have a textarea named: Lyrics. Is there a way when I change the last option (song) the textarea will be filled with the apropriate lyric of the song? In pseudo code it will be somthing like:
If song_id is changed, fill the textarea with the lyrics belonging to the song_id.

Thx in advance for the help!

Peace

messageRe: onChange editing textarea
Posted by: panos (IP Logged)
Date: May 22, 2007 03:25PM

Hi, nice problem placed here!

First thing you need to handle onChange event of the 3rd select box. See example
[www.salix.gr] posted for another friend ho wanted
just to redirect.

Next thing you need is to use prototype's ajax object to fetch text from database.
This class it self uses that object. You can find a simple example of usage here [www.salix.gr]

Hope this helps. Give it a try and keep me posted.

Regards
Panos

messageRe: onChange editing textarea
Posted by: moonwalker (IP Logged)
Date: May 22, 2007 03:28PM

Thank you Panos for your reply! I'm tired today so I will give it a shot tomorrow morning and I will certainly keep you posted!

Cheers.



Sorry, only registered users may post in this forum.

All Rights Reserved 2006 Salix.gr  |  Design by Ades Design |  Hosting by e-emporio |  forum.Salix.gr powered by Phorum