[support] Submiting form using ajax

bharani kumar bharanikumariyerphp at gmail.com
Fri Nov 7 16:24:24 UTC 2008


Hi member

I crated the form , which contains some text fields and  option  button,

I want to submit the form using ajax submit,

Can one guide me, how do submit the form using ajax,(without page reload),,




    $form['city'] = array(
    '#id' =>'testcity',
     '#title' => t('Where'),
     '#type' => 'radios',
     '#description' => t(''),
     '#options' => array(t('City'),t('Address')),
     '#default_value' => variable_get('city', 0),
     '#required' => TRUE,
     '#attributes' => array('onclick' => "javascript:callform(this.value)"),
    );


    $form['txtWhere'] = array(
     '#title' => t('Where'),
     '#type' => 'textfield',
     '#description' => t(''),
     '#required' => TRUE,
    );

    $form['txtChkIn'] = array(
     '#title' => t('Check-In'),
     '#type' => 'textfield',
     '#description' => t(''),
     '#attributes' => array('class' => 'jscalendar'),
             '#jscalendar_ifFormat' => '%Y-%m-%d %H:%M',
             '#jscalendar_showsTime' => 'true',

    );

    $form['txtChkOut'] = array(
     '#title' => t('Check-Out'),
     '#type' => 'textfield',
     '#description' => t(''),
     '#attributes' => array('class' => 'jscalendar'),
             '#jscalendar_ifFormat' => '%Y-%m-%d %H:%M',
             '#jscalendar_showsTime' => 'true',
    );

    $form['guest'] = array(
        '#type' => 'select',
        '#title' => t('Guests'),
        '#options' => array(
        1 => '1',
        2 => '2',
        3 => '3',
        4 => '4',
        5 => '5',
        ),
        '#default_value' => '1',
        '#description' => t(''),
        '#required' => TRUE
    );

    $form['rooms'] = array(
        '#type' => 'select',
        '#title' => t('Rooms'),
        '#options' => array(
        1 => '1',
        2 => '2',
        3 => '3',
        4 => '4',
        5 => '5',
        ),
        '#default_value' => '1',
        '#description' => t(''),
        '#required' => TRUE
    );

    $form['submit'] = array(
       '#type' => 'submit',
       '#value' => t('submit')
      );
    return $form;




-- 
உங்கள் நண்பன்
பரணி  குமார்

Regards
B.S.Bharanikumar

POST YOUR OPINION
http://bharanikumariyer.hyperphp.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20081107/fd0f2465/attachment.htm 


More information about the support mailing list