last day (16 days later) » 

17:06
0
A: Trying to create a widget that submits a form and takes you to another search page

berlinerIt's not clear from your question, so I will assume that you are missing the following: /** * Submit handler for facet form. */ function resource_library_facetapi_select_submit($form, &$form_state) { $form_state['redirect'] = array( $_GET['q'], array('query' => unserialize($form_stat...

No, I didn't include that, but that's on there.
@AndrewAlexander So this function exists, is called and the $form_state['redirect'] is set?
function resource_library_facetapi_select_submit($form, &$form_state) {
$form_state['redirect'] = array($_GET['q'], array('query' => unserialize($form_state['values']['select'])));
}
It should be called by $form['submit'] = array(
'#type' => 'submit',
'#value' => t('Find Resources'),
//'#attributes' => array('class' => array('ctools-use-ajax', 'ctools-auto-submit-click')),
); - correct?
@AndrewAlexander resource_library_facetapi_select_submit follows a naming convention and should be called in your case, yes. But just in case, can you verify this by adding a drupal_set_message or something similar?
Where should I put the drupal_set_message? I'll be honest, I'm not entirely sure of the way that Drupal is calling the submit function.
17:06
@AndrewAlexander Put the drupal_set_message in the first line of the resource_library_facetapi_select_submit function.
function resource_library_facetapi_select_submit($form, &$form_state) {
drupal_set_message(print_r($form_state['redirect'] = array($_GET['q'], array('query' => unserialize($form_state['values']['select'], true)))));
} gives me a value of "1" in my messages.
@AndrewAlexander That is normal, because the result of the assignment is TRUE when the assignment has been executed without an error, and TRUE gets converted to 1 in print_r. But it already shows that the submit function is called. Try to set $form_state['redirect'] = 'node';, just to see if this redirects to the node page, that will tell us, if the most simple redirect is respected.
I already tried a simple redirect with google.com, and that worked correctly.
However $form_state['redirect'] = 'node'; did not, it left it at the same page.
But this is for a search page, so there shouldn't be a node, correct?
Alright, what to do now?
The 'node' part was just a test, this doesn't work? Ok, what is the url of the site where you are?
Node did not work. Google.com did. And it is a local site currently.
17:16
Can you please add the following to your submit handler:
drupal_set_messsage(print_r($form_state['values'], TRUE));
and then paste back the result
18:07
Call to undefined function drupal_set_messsage()
function resource_library_facetapi_select_submit($form, &$form_state) {
drupal_set_messsage(print_r($form_state['values'], true));
//$form_state['redirect'] = array($_GET['q'], array('query' => unserialize($form_state['values']['select'], true)));

}
works when I do it for the original $form_state['redirect']
 
2 hours later…
19:45
Nevermind, there was a typo. Now when I am doing it, it provides absolutely nothing.
Array ( [select] => Array ( [a:1:{s:1:"f";a:1:{i:0;s:33:"sm_field_resource_type:Datasheets";}}] => a:1:{s:1:"f";a:1:{i:0;s:33:"sm_field_resource_type:Datasheets";}} [a:1:{s:1:"f";a:1:{i:0;s:30:"sm_field_resource_type:Manuals";}}] => 0 [a:1:{s:1:"f";a:1:{i:0;s:41:"sm_field_resource_type:Software Utilities";}}] =>
0 [a:1:{s:1:"f";a:1:{i:0;s:36:"sm_field_resource_type:IPC App Notes";}}] => 0 [a:1:{s:1:"f";a:1:{i:0;s:45:"sm_field_resource_type:Product Certifications";}}] => 0 [a:1:{s:1:"f";a:1:{i:0;s:44:"sm_field_resource_type:Generic File Resource";}}] => 0 [a:1:{s:1:"f";a:1:{i:0;s:47:"sm_field_resource_type:Product Company Brochure";}}] => 0 [a:1:{s:1:"f";a:1:{i:0;s:41:"sm_field_resource_type:Dimension Diagrams";}}] => 0 [a:1:{s:1:"f";a:1:{i:0;s:40:"sm_field_resource_type:Support Documents";}}] =>
0 [a:1:{s:1:"f";a:1:{i:0;s:35:"sm_field_resource_type:White Papers";}}] => 0 ) [submit] => Find Resources [form_build_id] => form-vxC_RrhqEDFXIz4_lnObx4MFm-sXnZprhFnKHGDI2-U [form_token] => Oa-7C5TZe0pHsGm7748EeW5AJ3n2JkoPTJ4c1fAd5sY [form_id] => resource_library_facetapi_select [op] => Find Resources )

  last day (16 days later) »