You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Reda Mokrane <ga...@yahoo.ca> on 2003/05/08 04:38:08 UTC
Validation on and Off?
Hi!!!Is it possible to turn the validation on and off?I have form with 3 buttons Save Update and Add, I'm doing the validation with the validition.xml to validate the required fields so how can I turn the validator off when the user click on update or add i 'want the validation to be on only when he hit the save. Reda Mokrane
---------------------------------
Post your free ad now! Yahoo! Canada Personals
RE: Available Javascript (calendar) popups that work with Struts?
Posted by Richard Mixon <rn...@custco.biz>.
Sergey,
Thanks - OK - now I get further. But it still tries to access the actual JSP
page (which of course it cannot get to as all of my pages are under
WEB-INF/pages). Here is the message:
HTTP Status 404 - /stars/WEB-INF/pages/editAssessment.jsp
--------------------------------------------------------------------------
------
type Status report
message /stars/WEB-INF/pages/editAssessment.jsp
description The requested resource
(/stars/WEB-INF/pages/editAssessment.jsp) is not available.
--------------------------------------------------------------------------
------
Apache Tomcat/4.1.24-LE-jdk14
Below is the generated HTML (from view source in the browser window). The
statement in question is about 25 lines down.
Any other ideas? Thanks - Richard
<html>
<base href="http://localhost:8080/stars/WEB-INF/pages/editAssessment.jsp" />
<script language="JavaScript" src="/stars/scripts/ts_picker.js">
//Script by Denis Gritcyuk: tspicker@yahoo.com
//Submitted to JavaScript Kit (http://javascriptkit.com)
//Visit http://javascriptkit.com for this script
</script>
<BODY ONLOAD="javascript:loadData();">
<form NAME="edit">
<h3>
Editing assessment # 3
</h3>
<P> Enter data for this assessment then click the Done button at the bottom
when you are finished.
<TABLE>
<TR>
<TD>
<INPUT TYPE="text" SIZE="24" VALUE="Assessment Date"
READONLY="true"/>
</TD>
<TD>
<INPUT TYPE="TEXT"
NAME="assessments[2].assessmentDate"
size="6"
value="2003-05-30"
/>
<a href="#"
onclick="javascript:show_calendar('document.forms[0].assessments[2].assessme
ntDate', document.forms[0].assessments[2].assessmentDate.value); return
false;"><img src="/stars/images/cal.gif" width="16" height="16" border="0"
alt="Click Here to Pick up the timestamp"></a>
</TD>
</TR>
</TABLE>
<BR>
<TABLE>
<TR>
<TH> Student Name </TH>
<TH> Result </TH>
</TR>
<TR>
<TD> <input type="text" name="rows[0].student" size="24" value="Nelson
A Mixon" readonly="readonly" /> </TD>
<TD><input type="text"
name="rows[0].results[2].resultValue"
size="2"
value="3.0" /></TD>
</TR>
<TR>
<TD> <input type="text" name="rows[1].student" size="24" value="John A
Doe" readonly="readonly" /> </TD>
<TD><input type="text"
name="rows[1].results[2].resultValue"
size="2"
value="3.0" /></TD>
</TR>
<TR>
<TD> <input type="text" name="rows[2].student" size="24" value="Sue Z
Smith" readonly="readonly" /> </TD>
<TD><input type="text"
name="rows[2].results[2].resultValue"
size="2"
value="5.0" /></TD>
</TR>
</TABLE>
<SCRIPT>
function doneEditing( ) {
//map assessment date back
controlName = "assessments[" + 2 + "].assessmentDate";
for (i = 0; i < window.opener.document.classGridForm.length; i++)
{
if (window.opener.document.classGridForm.elements[i].name ==
controlName)
{
targetIndex = i;
}
}
for (i = 0; i < edit.length; i++)
{
if (edit.elements[i].name == controlName)
{
sourceIndex = i;
}
}
window.opener.document.classGridForm.elements[targetIndex].value =
edit.elements[sourceIndex].value;
//map results back
for (j = 0; j < 3; j ++) {
controlName = "rows[" + j + "].results[" + 2 + "].resultValue";
for (i = 0; i < window.opener.document.classGridForm.length; i++)
{
if (window.opener.document.classGridForm.elements[i].name ==
controlName)
{
targetControlIndex = i;
break;
}
}
for (k = 0; k < edit.length; k ++)
{
if (edit.elements[k].name == controlName)
{
sourceControlIndex = k;
break;
}
}
window.opener.document.classGridForm.elements[targetControlIndex].value
= edit.elements[sourceControlIndex].value;
}
window.close();
}
function clearResults() {
for (k = 0; k < edit.length; k ++)
{
if (edit.elements[k].name == controlName)
{
edit.elements[k].value = "";
break;
}
}
assessmentDateControlName = "assessments[" + 2 + "].assessmentDate";
for (j = 0; j < 3; j ++) {
controlName = "rows[" + j + "].results[" + 2 + "].resultValue"
for (i = 0; i < edit.length; i++)
{
if (edit.elements[i].name == assessmentDateControlName)
{
edit.elements[i].value="";
}
else if (edit.elements[i].name == controlName)
{
edit.elements[i].value="";
}
}
}
}
function loadData()
{
for (j = 0; j < 3; j ++) {
controlName = "rows[" + j + "].results[" + 2 + "].resultValue"
for (i = 0; i < window.opener.document.classGridForm.length; i++)
{
if (window.opener.document.classGridForm.elements[i].name ==
controlName)
{
sourceControlIndex = i;
break;
}
}
for (k = 0; k < edit.length; k ++)
{
if (edit.elements[k].name == controlName)
{
targetControlIndex = k;
break;
}
}
//alert(window.opener.document.classGridForm.elements[i].name);
edit.elements[targetControlIndex].value =
window.opener.document.classGridForm.elements[sourceControlIndex].value;
}
}
function cancelEditing()
{
window.close();
}
</script>
<INPUT type="Button" name="" value="Clear All Results"
onclick="clearResults();"/>
<input name="" type="button" value="Done" onclick='doneEditing();'/>
<input name="" type="button" value="Cancel" onclick='cancelEditing();'/>
<form>
</BODY>
</html>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: Available Javascript (calendar) popups that work with Struts?
Posted by Sergey Smirnov <si...@exadel.com>.
Put return false; just after your popup function.
for example:
"<a href="#" onclick="calendar() ; return false;" >Calendar </a>
Regards
Sergey Smirnov
http://www.exadel.com/strutsStudio
----- Original Message -----
From: "Richard Mixon" <rn...@custco.biz>
To: "'Struts Users Mailing List'" <st...@jakarta.apache.org>
Sent: Wednesday, May 07, 2003 10:06 PM
Subject: Available Javascript (calendar) popups that work with Struts?
> I've been trying to get a couple of the popular calendar popups to work
with
> my Struts-based form. In each case they want to use an anchor (e.g. "<a
> href="#" onclick="..." > </a>) for positioning of the popup window. When
you
> click on button it tries to resolve by appending the # to the end of the
> struts action (e.g. http://localhost:8080/myapp/myaction.doc#).
>
> Of course this fails.
>
> If anybody know of a working solution, it would be much appreciated.
>
> Thanks - Richard
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Available Javascript (calendar) popups that work with Struts?
Posted by Richard Mixon <rn...@custco.biz>.
I've been trying to get a couple of the popular calendar popups to work with
my Struts-based form. In each case they want to use an anchor (e.g. "<a
href="#" onclick="..." > </a>) for positioning of the popup window. When you
click on button it tries to resolve by appending the # to the end of the
struts action (e.g. http://localhost:8080/myapp/myaction.doc#).
Of course this fails.
If anybody know of a working solution, it would be much appreciated.
Thanks - Richard
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: Validation on and Off?
Posted by Michael Santos <mi...@hotmail.com>.
You could set 'bCancel=false' using Javascript on your onclick attribute for
the buttons.
--
Michael Nascimento Santos
JSR-207 Expert Group Member
Sun Certified Programmer for the Java 2 Platform
Sun Certified Programmer for the Java 2 Platform 1.4
Sun Certified Web Component Developer for J2EE
Moderador SouJava - www.soujava.org.br
----- Original Message -----
From: "Dan Tran" <da...@hotmail.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Wednesday, May 07, 2003 11:41 PM
Subject: Re: Validation on and Off?
> Override the validate() in action form and check for action type
>
> -Dan
>
> ----- Original Message -----
> From: "Reda Mokrane" <ga...@yahoo.ca>
> To: <st...@jakarta.apache.org>
> Sent: Wednesday, May 07, 2003 7:38 PM
> Subject: Validation on and Off?
>
>
> > Hi!!!Is it possible to turn the validation on and off?I have form with 3
> buttons Save Update and Add, I'm doing the validation with the
> validition.xml to validate the required fields so how can I turn the
> validator off when the user click on update or add i 'want the validation
to
> be on only when he hit the save. Reda Mokrane
> >
> >
> > ---------------------------------
> > Post your free ad now! Yahoo! Canada Personals
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: Validation on and Off?
Posted by Dan Tran <da...@hotmail.com>.
Override the validate() in action form and check for action type
-Dan
----- Original Message -----
From: "Reda Mokrane" <ga...@yahoo.ca>
To: <st...@jakarta.apache.org>
Sent: Wednesday, May 07, 2003 7:38 PM
Subject: Validation on and Off?
> Hi!!!Is it possible to turn the validation on and off?I have form with 3
buttons Save Update and Add, I'm doing the validation with the
validition.xml to validate the required fields so how can I turn the
validator off when the user click on update or add i 'want the validation to
be on only when he hit the save. Reda Mokrane
>
>
> ---------------------------------
> Post your free ad now! Yahoo! Canada Personals
>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org