2

I need to implement a select list (something like auto-complete in JQuery UI) with a Go button on a mini-panel (or block). I can do this in Javascript. When the user selects a value, a corresponding page (for example: article) URL is computed.

Assuming we know the URL of that page, how do I get Drupal to jump to that page when the user clicks on the Go button? I am no expert in PHP, but could implement some if necessary, or is there a better solution?

1 Answer 1

2

If the whole implementation (including the URL computing) is done on the client side with javascript then the easiest solution would be to simply use code like the following:

$('#go_button_id').click(function() {
  location.href = 'url_to_the_computed_page';
});

On the server side you could use Drupal's block hooks and form API to create a block with a simple form and then use $form_state['redirect'] = 'url_to_the_computed_page'; in the form submission handler for the redirect.

1
  • Ok, thanks. I was thinking the same since everything was on the client side. Feb 7, 2012 at 5:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.