Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SQL and Javascript

 
Gemma Cameron
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
firstly I have 2 problems...

I want to catch an empty SQL statement to deliver an error message to the user - currently the last SQL statement posted by the user is returned... Is there an isEmpty() method or similar? I have looked an found nothing on sun's website.. or if anyone has any ideas I would be greatful. ( :

Also I have a Javascript problem. I want to check that the user has only entered numbers into a field. I have a .js file to create a pop up and that doesn't seem to work... here is the code I used:

String url = getInitParameter("popup-url");

if(url==null || url.equals(""))
url = "http://localhost/CCNs/help.htm";

url=request.getContextPath()+url;

//set the MIME type of the response, "text/html"
response.setContentType("text/html");

RequestDispatcher dispatcher = request.getRequestDispatcher("/WEB-INF/javascript.functions.js");

dispatcher.include(request, response);

out.println("<form>");
out.println("<input type=\"button\" name=\"help\" " + "value=\"Help\" onKlick=\"CreateWindow('" + url+ "')\">");
out.println("</form>");

And here is the function.js:
<script language="JavaScript">
function CreateWindow(uri)
{
var newWin=window.open(uri, 'newwin1',width=500,height=400,resizable,' + 'scrollable,scrollbars=yes');
newWin.focus()
}

</script>

When I click on the "help" button I get "error on page" message in the status bar.

Thanks in anticipation!

Gemma
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
your missing a quote in your window.open statement, hence an error message appears.
 
Gemma Cameron
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you!!!

Another classic "Gemma Error". ( :

Thanks again!!!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic