If you're doing validation in JavaScript anyway, why wouldn't you use a 
JavaScript-based date validation method and avoid the heinous mixing of Java 
and JavaScript?!

Dave

--- On Thu, 7/10/08, vimala <[EMAIL PROTECTED]> wrote:
> I am using struts for web application development. I have a
> class
> clsDateTools within which I define a function public
> boolean isDate(String
> dateToCheck) for validating date values. Here is my jsp
> page 
> 
> <%@ page import="visg.usrBeans.clsDateTools"
> %>
> 
> <html:html>
> 
> <script language="JavaScript">
> 
> <% clsDateTools datetool = new clsDateTools();%>
> 
> function Save(){
>       
>       ................................
>       ................................
> 
>       if(document.someActionForm.txtInspectionDate.value !=
> ""){                  
>               valuefn = <%
> =isDate(document.someActionForm.txtInspectionDate.value)
> %>;
>                       
>               if(valueFn == false){
>                       alert("Enter valid Complication Date in
> dd/mm/yyyy");
>                       return false;
>               }
>       }
> }
> 
> </script>
> 
> 
> <body onload="onLoadFn()">
>     <html:form action="/someAction.do">
>       <table align="center"
> width="100%">
>               <tr>
>               ......
>               </tr>
> 
>               <tr>
>                       <td align="right"
> width="50%">
>                               <p
> class="normaltextualtheme">Inspection
> Date</p>
>                       </td>
>                       <td align="left"
> width="50%">
>                               <script language='javascript'>        
>        
>                                       var datevalue =
> "<%=request.getSession().getAttribute("txtInspectionDate")%>";
>                                       if(datevalue=="null") {
>                                               datevalue =
> "<%=datetool.stringnoDate("/")%>";
>                                       }
>                                       if (!document.layers) {
>                                       document.write("<input
> readonly='readonly' type=text
> name=\"txtInspectionDate\"
> tabindex=\"2\"
> value=\""+datevalue+"\" size=10
> class=\"readonly\" >");
>                                       document.write("<input type = button
> name=\"B3\" style=\"width: 20;
> height: 20;background-image:
> url('./images/show-calendar.gif') \"
> value=\"\"
> onclick='popUpCalendar(ttxtInspectionDate,
> txtInspectionDate,
> \"dd/mm/yyyy\");return
> false;'>");
>                       }
>                               </script>
>                       </td>
>               </tr>
>       </table>
> 
>     </html:form>
> </body>
> 
> </html:html>
> 
> For the code line valuefn = <%
> =isDate(document.someActionForm.txtInspectionDate.value)
> %>,
> it shows an error message 'document is unresolved
> type'. How can I pass the
> action form values as parameters within javascript?


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

Reply via email to