-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Laurie Harper wrote:
>
> If that's the case, you probably just have an error in your validation
> configuration. Post the relevant parts of that for review.
>
>
OK.. here goes:
I'll use the simplest of the forms and work from there. The JSP for a
form that is used to send email.
- -------------- 8< snip 8<-------------------------------------------
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<html:form action="/actions/public/system/sendEmail" method="POST"
onsubmit="return validateSendEmailForm(this);">
<p>
Use this form to send an email. All fields are considered
mandatory.
Email addresses will be checked for validity.
</p>
<p>
Please be sure to include your real name in the body of the
message to
avoid confusion on the part of the email recipient
</p>
<p style="border: 1px; color: red; ">
<html:errors />
</p>
<hr>
<table width="100%">
<tr height="30">
<td width="30%" align="right">
From:
<br>
(Your email address)
</td>
<td>
<html:text property="from_rq" size="40"
maxlength="80" />
<br>
<html:errors property="label.from" />
</td>
</tr>
<tr height="30">
<td width="30%" align="right">
Subject:
</td>
<td>
<html:text property="subject_rq" size="40"
maxlength="72" />
<br>
<html:errors property="label.subject" />
</td>
</tr>
<tr>
<td width="30%" align="right">
Message body:
</td>
<td>
<html:textarea property="body_rq" rows="10"
cols="40" />
<br>
<html:errors property="body_rq" />
</td>
</tr>
<tr>
<td colspan="2">
<table width="100%">
<tr>
<td width="33%">
<html:cancel
value="abort" property="action_rq" />
</td>
<td width="34%">
</td>
<td>
<html:submit
value="Send" property="action_rq"></html:submit>
</td>
</tr>
</table>
</td>
</tr>
</table>
<html:javascript formName="sendEmailForm"/>
</html:form>
- -------------- 8< snip 8<-------------------------------------------
It's definition in tiles-defs.xml
- -------------- 8< snip 8<-------------------------------------------
<definition name=".public.email.send" extends=".public.layout">
<put name="content" value="/content-pages/public/sendEmail.jsp"
/>
<put name="title"
value="Bayshore Companion Dog Club:Send Email" />
</definition>
- -------------- 8< snip 8<-------------------------------------------
Here are the entries in struts-config.xml that make use of it:
- -------------- 8< snip 8<-------------------------------------------
<form-bean name="sendEmailForm"
type="org.bcdc.struts.form.SendEmailForm" />
<... and later ...>
<action path="/actions/public/sendEmail"
forward=".public.email.send" />
<... a few lines later...>
<action attribute="sendEmailForm"
input=".public.email.send"
name="sendEmailForm"
path="/actions/public/system/sendEmail"
scope="request"
validate="yes"
type="org.bcdc.struts.action.SendEmailAction">
<forward name="class_detail"
path="/actions/public/class/detail.do" />
<forward name="failure"
path="/actions/public/sendEmail.do" />
</action>
- -------------- 8< snip 8<-------------------------------------------
and here is the validation rule for the form.
- -------------- 8< snip 8<-------------------------------------------
<form name="sendEmailForm">
<field property="from_rq" depends="required,email">
<arg key="label.from"/>
</field>
<field property="subject_rq" depends="required">
<arg key="label.subject"/>
</field>
<field property="body_rq" depends="required">
<arg0 key="label.body"/>
</field>
</form>
- -------------- 8< snip 8<-------------------------------------------
The form bean is defined an extension of a ValidatorForm. Just to try
and get things working I went the path of using JavaScript client side
validation, but my goal is to move that to server side eventually.
- --
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Peter L. Berghold [EMAIL PROTECTED]
"Those who fail to learn from history are condemned to repeat it."
AIM: redcowdawg Yahoo IM: blue_cowdawg ICQ: 11455958
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Red Hat - http://enigmail.mozdev.org
iD8DBQFF7J+4UM9/01RIhaARAmmwAJ9IUTDMdv/U2H3d1Pivzd7seX/3zACbBols
mvkVjB3pRgZdqao+htkYBNo=
=1QH3
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]