Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6572479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:00:40+00:00 2026-05-25T15:00:40+00:00

Drupal 6.22 I have an empty page except for a form that takes two

  • 0

Drupal 6.22

I have an empty page except for a form that takes two input values and, when submitted, must display the result of a query based on that. The result may be displayed in a new window or on the same page, the only requirement is that the form is still easily accessible. I’ve tried to use AHAH to achieve this but I haven’t found a way to send along the input.

This is what I have now:

function somemodule_menu()
{
    $items['somemodule/js'] = array(
        'page callback' => 'somemodule_js',
        'access arguments' => array('access content'),
        'type' => MENU_CALLBACK,
    );

    return $items;
}

function somemodule_form()
{
    $form = array();
    $format = 'd/m/Y';
    $default = 'Y-m-d 00:00:00';

    $form['from'] = array(
        '#type' => 'date_popup',
        '#title' => t('From'),
        '#default_value' => date($default),
        '#date_format' => $format,
        '#required' => TRUE
    );

    $form['to'] = array(
        '#type' => 'date_popup',
        '#title' => t('To'),
        '#default_value' => date($default, mktime(0, 0, 0, date('n') + 6)),
        '#date_format' => $format,
        '#required' => TRUE
    );

    $form['submit'] = array(
        '#type' => 'submit',
        '#value' => t('Send'),
        '#ahah' => array(
            'path' => 'somemodule/js',
            'wrapper' => 'entry-wrapper',
            'method' => 'replace',
            'progress' => array(
                'type' => 'bar',
                'message' => t('Please wait...')
            )
        )
    );

    return $form;
}

function somemodule_js()
{
    return drupal_json(array('status' => TRUE, 'data' => "some data"));
}

This submits the form and correctly inserts some data into entry-wrapper. I know that I can make the following changes:

function somemodule_menu()
{
    $items['somemodule/js/somevar'] = ...
}

function somemodule_form()
{
    ...
    $form['submit'] = array(
        '#ahah' => array(
            'path' => 'somemodule/js/wharrgarbl',
    ...
}

function somemodule_js($string)
{
    return drupal_json(array('status' => TRUE, 'data' => $string));
}

and I’ll get wharrgarbl back, but a static value rather defeats the point.

Is there a way to access the form state of somemodule_form from within that function after the first submission or am I going about this entirely the wrong way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T15:00:40+00:00Added an answer on May 25, 2026 at 3:00 pm

    I don’t know how I missed it but the signature for hook form is hook_form(&$node, $form_state). PHP’s forgiveness can be a curse sometimes. Anyway, a completely unrelated Google search turned up this question about multistep forms, which is what I ended up doing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Drupal module page where I am populating a form with a
I have a Drupal view that displays vacation leaves for a particular employee. I
I have a Drupal setup like this: Content type: Apartments Vocabulary: Areas , that
I have a situation that if my form doesn't validate I need it to
In Drupal I have two image fields, one to act as a thumbnail and
I have a Drupal 5 website on which I want to display a list
In Drupal I have the page content type. I have created a vocublary and
I'm working with the Zen theme in Drupal and have discovered that I can
I need to do one of two things in Drupal have the ability to
I have two fields I want to fill with the exactly same values; users

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.