0

My registration form is multi-step and the form is shown in popup. I m using lighbox2 for popup and working perfectly fine and i have added the form filed in a file that comes with lightbox2 and place in template folder and everything work fine, but the issue is how i can add the form data in database?

I use ajax when the ajax request sent it says access forbidden.

how I can insert data in database using ajax because my form is multi-step?

1 Answer 1

1

You'll need to define an ajax callback. This callback function can then be called by the form, and can submit values to the database for you using the Drupal database layer. In this case, I imagine the ajax handler will be added to the Next or Submit button.

$form['next'] = array(
  '#type' => 'submit',
  '#value' => t('Submit'),
  '#ajax' => array(
    'callback' => 'custom_ajax_callback'
  ),
);

Your module might also want to define its own database table to store temporary values for this.

2
  • 1
    That's not how callback is used in #ajax - it needs to be the name of a function, not a path
    – Clive
    Commented Apr 1, 2013 at 13:46
  • Clive, thanks. Made the correction. I got path and callback confused.
    – jazzdrive3
    Commented Apr 1, 2013 at 15:49

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.