Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7731629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T06:31:46+00:00 2026-06-01T06:31:46+00:00

I’ve create a form like: function create_custom_form($form, &$form_state) { $form[‘#action’] = #; …. }

  • 0

I’ve create a form like:

function create_custom_form($form, &$form_state) {
    $form['#action'] = "#";
        ....
}

function create_custom_form_validate($form, &$form_state) {
        ....
}

function create_custom_form_submit($form, &$form_state) {
        ....
        if(..)
           drupal_goto('abc');
        else
           drupal_goto('xxx');
}

when i submit this form drupal before go to action and after read my function… how I can bypass the action-form and read only a _submit function?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T06:31:47+00:00Added an answer on June 1, 2026 at 6:31 am

    Do not use drupal_goto as there may be more “submit” callbacks to execute. The drupal_goto function will interrupt these.

    Instead, use the $form_state['redirect'] = ...
    http://api.drupal.org/api/drupal/includes!form.inc/function/drupal_redirect_form/7

    function create_custom_form_submit($form, &$form_state) {
            ....
            if(..)
               $form_state['redirect'] = 'abc';
            else
               $form_state['redirect'] = 'xxx';
    }
    

    As this function has the same form ID (create_custom_form) – with the word “_submit” appended then this function will be executed automatically and so there is no need to add any submit callbacks into the form.

    If you want an additional function to execute on submit then you should do as Hamza has suggested, only your additional function will have a different name. e.g.

    function create_custom_form($form, &$form_state) {
      $form['#action'] = "#";
      ....
      // Add any additional callbacks to call before any redirects happen
      $form['#submit'][] = 'create_custom_form_additional_submit_callback';    
      $form['#submit'][] = ...
    }
    
    function create_custom_form_additional_submit_callback($form, &$form_state) {
      // Do something before redirect
      ...
    }
    

    In the above example:

    • create_custom_form_additional_submit_callback

    AND

    • create_custom_form_submit (because its got the same name with ‘_submit’ appended)

    will execute and only when they have both finished will the redirect be executed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Basically, what I'm trying to create is a page of div tags, each has
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
I am trying to render a haml file in a javascript response like so:
I would like to run a str_replace or preg_replace which looks for certain words
I have a text area in my form which accepts all possible characters from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.