[support] question about jquery selectboxes plugin

Carl Wiedemann carl.wiedemann at gmail.com
Mon Dec 6 18:01:29 UTC 2010


Instead of using 'inline' with drupal_add_js(), consider using 'setting'
instead and passing it an array, which will be available in the same fashion
as Drupal.settings.basePath.
http://api.drupal.org/api/drupal/includes--common.inc/function/drupal_add_js/6

On Mon, Dec 6, 2010 at 10:31 AM, Aldo Martinez Selleras <aldo at caonao.cu>wrote:

> I'm creating a select box dynamically from JSON data, and setting up a
> selected value in URL, but I have a problem.
>
> http://...../gallery/2
>
> My php code:
> $selected = arg(1);
>
> if ( $selected ) {
>   drupal_add_js('var url_class = '. $selected, 'inline');
> }
>
>
> My javascript code:
>
> $('#class-filter').addOption({'0':' -- ALL -- '},false);
> $('#class-filter').ajaxAddOption(Drupal.settings.basePath +
> 'gallery/class',{},true, my_selectOption);
>
> function my_selectOption(){
>   $(this).selectOptions( '' + url_class + '', true );
> }
>
> var classification = $('#gallery-classification-filter').val();
>
>
> The select box is created OK, and the value showed as selected is ==
> url_class, but the value of the object still is 0.
>
> The question:
>
> Why classification value == 0??? must be == url_class!!
>
>
> --
> [ Drupal support list | http://lists.drupal.org/ ]
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20101206/cadd44ba/attachment.html 


More information about the support mailing list