Guest User

Untitled

a guest
Mar 21st, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. $(#my_form_id).submit(function (){
  2. parent.window.location="/user/register";
  3. });
  4.  
  5. $form['submit'] = array(
  6. '#prefix' => '<div id="super-cool-wrapper"></div>',
  7. '#type' => 'button',
  8. '#value' => 'Submit',
  9. '#ajax' => array(
  10. 'callback' => 'my_super_cool_ajax_callback',
  11. 'wrapper' => 'super-cool-wrapper',
  12. 'method' => 'replace',
  13. ),
  14. );
  15.  
  16. function my_super_cool_ajax_callback($form, $form_state) {
  17. // Do what you normally would with the form submission.
  18. return '<script type="text/javascript">
  19. parent.window.location="some/where";
  20. </script>';
  21. }
  22.  
  23. function mymodule_showmodal($js) {
  24. ctools_include('modal');
  25. ctools_include('ajax');
  26.  
  27. $form_state = array(
  28. 'ajax' => true,
  29. );
  30. $commands = ctools_modal_form_wrapper('modform',$form_state);
  31. if ($form_state['executed']) {
  32. $commands = array(ctools_modal_command_dismiss());
  33. }
  34. print ajax_render($commands);
  35. exit();
  36. }
  37.  
  38. function my_module_node_presave($node){
  39. if ($node->type == 'product'){
  40. $GLOBALS['redirect_parent'] = 'product_list';
  41. }
  42. }
  43.  
  44. function my_module_drupal_goto_alter(){
  45. if (@$GLOBALS['redirect_parent']!=''){
  46. die('<script type="text/javascript">parent.window.location="/'.$GLOBALS['redirect_parent'].'";</script>');
  47. $GLOBALS['redirect_parent']='';
  48. }
  49. }
  50.  
  51. <?php
  52. echo l('Sign up here', 'user/register', array('query'=>array('destination'=>'thanks')));
  53. ?>
  54.  
  55. <?php
  56. print l('Forgot Your Password?', 'user/password', array('query'=>array('destination'=>'thanks')));
  57. ?>
Add Comment
Please, Sign In to add comment