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 9300873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T22:53:15+00:00 2026-06-18T22:53:15+00:00

When I navigate to the page, why is the send() function being called automatically?

  • 0

When I navigate to the page, why is the send() function being called automatically?

I want to be able to view the gsp page, fill in a few text fields, and THEN call the submit with an action of “send”

This is my gsp file

<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<meta name="layout" content="main"/>
<title>Contact Form</title>
</head>
<body>
<g:form name="contactForm" action = "send">
    <g:render template = "contactFormFields"/>
    <g:actionSubmit value = "submit" action = "send"/>
</g:form>
</body>
</html>

This is the contactFormFields template

<g:select name = 'subject' from = '${EmailService.options}' noSelection='Topic'/>

Contact Name: <g:textField name = "contact"/>
Contact Number: <g:textField name = "phone"/>
Contact Email: <g:textField name = "email"/>
Aditional Information:
<g:textArea name = "information" rows="5" cols="40"/>

EmailServiceController

class EmailServiceController {

    def defaultAction = "contactService"

    def send() {
        sendMail(){
            to "mygroovytest@gmail.com"
            from params.email
            subject params.subject
            body params.information
        }
    }
}

domain class

class EmailService {

    static constraints = {
        def options = new ArrayList()
        options.push("Qestions about service")
        options.push("Feedback on performed service")
        options.push("Other")
        options.push("Why am I doing this")
    }
}

gsp that calls the service

<div class="banner">
  <h1>My HVAC company</h1>
  <a href = "javascript: contactPop()"> Contact me today!</a>
  <a href = "services">Services</a>
  <a href = "emailService">Have Me Contact You!</a>
</div>
  • 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-18T22:53:16+00:00Added an answer on June 18, 2026 at 10:53 pm

    You don’t have a contactService action in your EmailServiceController so it’s probably treating send() as the default action when you link to the controller with no action name. Try adding an empty contactService action

    def contactService() { }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to use the arrow keys to navigate between the input text fields
I want to conditionally navigate to some page. If some condition is true i
I have a Internet explorer navigate to a page and I am able to
I am new to iPhone Developer. i want to do navigate to new page
I want to navigate to the particular page in my application and i also
I'm posting data to a page and after that I want to navigate to
I want to navigate to a website using pre-defined cookies, Add some text to
How to Navigate to another page when click on arrow in the pushpin layout?
I am using jquery mobile. I would like to navigate from one page to
I'm using webBrowser.Navigate(url) control to display page. I noticed this action steals focus 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.