Hi,

I have this select.jsp

<%@ taglib prefix="s" uri="/struts-tags"%>
<p>Employee Data</p>
<s:form action="*save*" validate="*true*" namespace="/person">
   <s:hidden id="id" name="employee.id" />
   <s:textfield id="firstName" label="First Name"
       name="employee.firstName" />
   <s:textfield id="lastName" label="Last Name" name="employee.lastName" />
   <s:textfield id="phoneNumber" label="Phone Number"
       name="employee.phoneNumber" />
   <s:submit theme="ajax" targets="employees" notifyTopics="/save" />
</s:form>

this is called index.jsp via ajax via struts mapping alias "select"

<%@ taglib prefix="s" uri="/struts-tags"%>
<html>
   <head>
       <s:head theme="ajax" debug="true"/>
       <script type="text/javascript">
dojo.event.topic.subscribe("/save", function(data, type, request) {
               if(type == "load") {
                   dojo.byId("id").value = "";
                   dojo.byId("firstName").value = "";
                   dojo.byId("lastName").value = "";
                   dojo.byId("phoneNumber").value = "";
               }
           });
       </script>
   </head>
   <body>
       <s:url action="list" id="descrsUrl"/>

       <div style="width: 300px;border-style: solid">
           <div style="text-align: right;">
               <s:a theme="ajax" notifyTopics="/refresh">Refresh</s:a>
           </div>
<s:div id="employees" theme="ajax" href="%{descrsUrl}" loadingText="Loading..." listenTopics="/refresh"/>
       </div>

       <br/>

/        <s:url action="select" id="selectUrl"/>
       <div style="width: 300px;border-style: solid">
<s:div id="empedit" theme="ajax" href="%{selectUrl}" loadingText="Loading Data..." listenTopics="/refedit"/>
       </div>
/    </body>
</html>

struts.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
   "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
   "http://struts.apache.org/dtds/struts-2.0.dtd";>
<struts>
   <constant name="struts.objectFactory" value="spring" />
   <constant name="struts.devMode" value="true" />

   <package name="person" extends="struts-default">

       <action name="list" method="execute" class="employeeAction">
           <result>pages/list.jsp</result>
           <result name="input">pages/list.jsp</result>
       </action>

       <action name="remove" class="employeeAction" method="remove">
           <result>pages/list.jsp</result>
           <result name="input">pages/list.jsp</result>
       </action>
<action name="edit" class="employeeAction" method="edit">
           <result>pages/list.jsp</result>
           <result name="input">pages/list.jsp</result>
       </action>

       <action name="*save*" class="*employeeAction*" method="*save*">
           <result>pages/list.jsp</result>
           <result name="input">pages/list.jsp</result>
       </action>
/ <action name="*select*" class="*employeeAction*" method="edit">
           <result>pages/select.jsp</result>
           <result name="input">pages/select.jsp</result>
       </action>
/    </package>

</struts>

when I run this and submit (which calls the "save" action), I get an error *ReferenceError: validateForm_save is not defined*

I already defined EmployeeAction-save-validation.xml

<!DOCTYPE validators PUBLIC
"-//OpenSymphony Group//XWork Validator 1.0//EN"
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd";>
<validators>
   <field name="employee.firstName">
       <field-validator type="requiredstring">
           <message>First name is required!</message>
       </field-validator>
   </field>
   <field name="employee.lastName">
       <field-validator type="requiredstring">
           <message>Last name is required!</message>
       </field-validator>
   </field>
</validators>


Where have I did wrong ? when its still embedded inside the index.jsp, the validation is running normally but when i click edit which will fill the backing bean Employee it wont show up immediately which i have to do it the ajax way and seperate it into select.jsp. Please help.

-Andre-





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to