• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

SQL and Javascript

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you!!!

Another classic "Gemma Error". ( :

Thanks again!!!
 
reply
    Bookmark Topic Watch Topic
  • New Topic