views:

16

answers:

0

In my module I have a form represented by

function comment_form(){
    // form definition
}

I have a menu entry example.com/get_comment_form mapped to form provider callback to serve this form via ajax.

function get_form_over_ajax(){
    drupal_json(array('form' => drupal_get_form('comment_form')));
}

The rendered form via ajax call has action as example.com/get_comment_form

On the other hand the same form is rendered on a page (example.com/comment_on_page)

function page_callback(){
   return drupal_get_form('comment_form'); 
}

The rendered form for page has action as example.com/comment_on_page

The same form has two different action paths for different rendering techniques.

The form fetched over ajax redirects to example.com/get_comment_form upon submission with template less form layout.

How to deal with such form which post content to ajax-content service url?