If your date is formatted, then onclick=callJs(<%= ... %>) won't work.
You'll end up with: callJs(1/1/2008) which will do some form of division
that is likely to be not what you wanted. ;-)

Put quotes around the scriptlet: callJs('<%= ... %>').

-Fred

On Tue, Jun 17, 2008 at 7:25 AM, raku <[EMAIL PROTECTED]> wrote:

>
> First.jsp
> ------------------
> <jsp:usebean id="db" class="db.dbClass" scope=session/>
> <html>
> <body>
> <form action="MyAction.jsp" method="post">
> <% ResultSet rs=db.executeQuery("select no,name from mytable");
> while(rs.next())
> {%>
> <input type=checkbox value=<%=rs.getString(1)%> onclick=callJs(<
> %=rs.getString(1)%>) >
> <%}
> %>
> <input type=text name=displaydatetxt id=displaydate/>
> </form>
> <script>
> function callJs(arg1)
> {
> var url="Ajax.jsp";
> new Ajax.Request(url, {asynchronous: true,method: "post",parameters:
> "ajaxrefno=" +arg1,
>                        onSuccess: function(request) {
>                        $('displaydatetxt').value =request.responseText;
>                        },
>                        onFailure: function(request) {
>                        $('displaydatetxt').value =request.responseText;}
>                        });
> }
> </script>
> </body>
> </html>
> ********************************
> Now the Ajax.jsp
> <html>
> <body><%
>  if(request.getParameter("ajaxrefno")!=null)
> {
> ResultSet rs=db.executeQuery("select  mydate from display_table where
> number='"+request.getParameter("ajaxrefno")+"' ");
> if(rs.next)
> {
> out.print(rs.getString(1));
> }
> }
> *******************************************
>
> The above code works fine...but the column mydate returns date in
> default oracle date format..and if  i want to format that date ...to
> dd/mm/yyyy,  but if i change the query  to
> select to_char(mydate,'dd/mm/yyyy') ....then in the First.jsp the
> value of the ....displaydatetxt shows as ..undefined .
> Is there any way to format the date value and send it as response..?
> Any Ideas?
>
>
>
>
> >
>


-- 
Science answers questions; philosophy questions answers.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to rubyonrails-spinoffs@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to