2

I have a dependent auto-complete form field in my custom module. After submission the form the auto-complete field shows above the result output. Now I want that submitted value should become default value after form submission. I tried like this:

'#default_value' => isset($form_state['values']['keys']) ? $form_state['values']['keys'] : '',

but not getting any value. I also tried like this:

'#default_value' => isset($_REQUEST['keys']) ? $_REQUEST['keys'] : '',

but still unable to get any value. someone please help.

4
  • Alhamdulillah! finally got my solution myself. I simply got a value from URL like this: '#default_value' => (arg(3)!= 'none') ? arg(3) : '',
    – WaQaR Ali
    Commented Jun 15, 2015 at 6:59
  • then you should include that (without the religious notation) as an answer and accept it once you are able
    – Geoff
    Commented Jun 15, 2015 at 16:35
  • yes, off course, i will add as an answer and accept it when I will able to do so. Good to see your suggestion @Geoff
    – WaQaR Ali
    Commented Jun 16, 2015 at 5:13
  • It helps keep it out of the unanswered list and makes it easier for someone else looking at it in the future
    – Geoff
    Commented Jun 16, 2015 at 5:15

1 Answer 1

1

Finally I found the solution myself. I simply got a value from URL like this:

'#default_value' => (arg(3)!= 'none') ? arg(3) : '',

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.