I got a bit further. I understand the $F bit now. However, I'm only
getting the following in my $_GET array in PHP:
Array
(
[url] => tests/ships
[13] =>
)
so the array's key has become the value I want. how can i get this in
the same form as the url value?
On 5 Mar, 15:38, "lukemack" <[EMAIL PROTECTED]> wrote:
> thanks very much for your reply.
>
> what is $F? I should point out that I am not using this within Rails.
> I was directed here by someone at the javascript group.
>
> your code gives me the following error:
>
> Error: missing } after property list
> Source File: xxxxxxx
> Line: 33, Column: 32
> Source Code:
> "get", parameters: chosen_option: $F("element_id") });
>
> thanks,
>
> lukemack.
>
> On 5 Mar, 14:48, David Dashifen Kees <[EMAIL PROTECTED]> wrote:
>
> > You should be able to use an onChange event on the first select box to
> > create an Ajax.Updater object with a parameter equaling the value of the
> > select box. Essentially:
>
> > <select id="choose_first" onChange="get_second_list()">
> > <option>....</option>
> > </select>
>
> > <div id="second_list"></div>
>
> > <script type="text/javascript">
> > function get_second_list() {
> > new Ajax.Updater("second_list", "get_second_list.php", { method:
> > "get", parameters: chosen_option: $F("choose_first") });
> > }
> > </script>
>
> > Your preference for unobtrusive Event.observe() calls versus inline
> > event handlers may alter the code and there may be better ways to do
> > this rather than using the empty div, but this should illustrate the
> > basics. The get_second_list.php page would have to get the value out of
> > the $_GET array, process it, and construct the neccessary select box
> > which would be placed in the "second_list" div.
>
> > Write back if you're still confused.
>
> > -- Dash --
>
> > lukemack wrote:
> > > hi,
>
> > > i am trying to make the contents of one drop-down box dependent on the
> > > contents of another using AJAX (prototype.js) and PHP
>
> > > I have it working so that a new dropdown appears when i select a value
> > > in the first dropdown:
>
> > > <?php echo $html->selectTag('Review/cruiseline', $cruise_lines, null,
> > > array('onchange'=>'new Ajax.Updater(\'test\', \'ships?variable=12\',
> > > { method: \'get\' }, {asynchronous:true, evalScripts:true});'), null,
> > > true, false);?>
>
> > > In my php script (which is located at URL 'ships'), I am just getting
> > > the value of 'variable' from the $_GET super global but I obviously
> > > want that value to be dynamic and equal to the value selected in the
> > > dropdown.
>
> > > So the missing piece is passing the selected dropdown value from
> > > HTML / Javascript to PHP. Anyone know how to do that?
>
> > > thanks,
>
> > > lukemack.
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---