Wednesday, 15 May 2013

grails - gsp mail plugin autosending -



grails - gsp mail plugin autosending -

when navigate page, why send() function beingness called automatically?

i want able view gsp page, fill in few text fields, , phone call submit action of "send"

this 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 contactformfields template

<g:select name = 'subject' = '${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(){ "mygroovytest@gmail.com" params.email subject params.subject body params.information } } }

domain class

class emailservice { static constraints = { def options = new arraylist() options.push("qestions service") options.push("feedback on performed service") options.push("other") options.push("why doing this") } }

gsp calls 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>

you don't have contactservice action in emailservicecontroller it's treating send() default action when link controller no action name. seek adding empty contactservice action

def contactservice() { }

grails controller grails-plugin gsp

No comments:

Post a Comment