Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Javascript function inside a JSP page

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am using Javascript function inside a JSP page for input field validation. The javacsript function is not working properly .

I am using multiple if conditions inside the javacsript function.  Even when I am leaving the fields blank the control is moving to next page.

I cannot use a normal HTML page as I would be doing some more processing on this page , that is why I have used JSP.

The input field validation is not working . I even tried to retrieve the elements Id but still the code is not working.

Below is my code:-



Any help in correcting above code will be greatly appreciated.

Thanks
 
Shaif Yadav
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

In the above code , I missed a bracket.

Correct code is

 
Marshal
Posts: 67425
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use the browser dev tools to set breakpoints and see where the code is doing something differently than what you expect.

P.S. Processing in a JSP is frowned upon -- if the page need pre-processing that should occur in a servlet.
 
"Don't believe every tiny ad you see on the internet. But this one is rock solid." - George Washington
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic