0

I want in add content have a link(or button) when user click on lt the popup (modal or any popuping method like dialog,modal,lightbox,colorbox ) will open, in that form I want have some field, like hierarchical select and long text fields, after user submit that form, the submitted values passed back to add content form,

appreciate any idea

1

I'd suggest an approach which is not a solid, but you can get an idea;

  • Create modal with Ctools (may be this and this links can help you to create it);
  • On form submission store the submitted data as array into $_SESSION;
  • reload the page with ctools_ajax_command_reload();

example:

// This is must be in ctools modal callback. Read modal.html file in ctools/help directory
if (!empty($form_state['executed'])) {
  $commands = array();
  $commands[] = ctools_ajax_command_reload();
}
  • Alter the content add form;

  • add #default_value to the fields, e.g.: '#default_value' => isset($_SESSION['modal_data']['field_1_value']) ? $_SESSION['modal_data']['field_1_value'] : '';

  • at the end of the content add form just unset the $_SESSION data, e.g.: unset($_SESSION['modal_data']);
  • good idea, but I dont know how can I reload main page after modal form submit? – Yusef Mohamadi Apr 10 '14 at 13:41
  • @zhilevan I updated the answer. – xurshid29 Apr 10 '14 at 13:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.