• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Empty Form Checking

 
Debojit Sinha
Ranch Hand
Posts: 66
Java Linux Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
In my learning PoC, I'm trying to create a search form. I'm stuck with one particular scenario at the moment: I want to show a popup when the user clicks "Submit" without entering any search parameters. I'm using the struts tags for submit as well as form input elements. Could someone provide some insight, please?

Thanks,
Debojit
 
Shankar Tanikella
Ranch Hand
Posts: 329
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So what have you tried and where are you stuck?
 
Debojit Sinha
Ranch Hand
Posts: 66
Java Linux Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shankar Tanikella wrote:So what have you tried and where are you stuck?


Hi,
Sorry for the delay in replying.

Actually, I'm stuck as to how to proceed. I'm using struts html tags, so I'm realy not sure as to how I'm going to get the values and validate them in a javascript. Upto now, I've been mostly sticking with plain old html tags, so struts(and JSTL) tags are a little new to me.

Thanks,
Debojit
 
vipul bondugula
Ranch Hand
Posts: 219
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is similar to html tags. Give each struts tag an id (UNIQUE). In Javascript using document.getElementById("idName"), get the component and do valdations or whatever manipulations.

Thanks
BVR.
 
Debojit Sinha
Ranch Hand
Posts: 66
Java Linux Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
vipul bondugula wrote:This is similar to html tags. Give each struts tag an id (UNIQUE). In Javascript using document.getElementById("idName"), get the component and do valdations or whatever manipulations.

Thanks
BVR.


I looked through the Struts tag documentation for HTML tags, and I couldn't find any attribute for id. Could you perhaps give me an example?

Thanks,
Debojit
 
vipul bondugula
Ranch Hand
Posts: 219
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am sorry Debojit...

For html tags you will specify property tag. In the browser these html tags convert to plain html. so if you write,



this will convert to



In order to access the component in javascript , you can call document.formName.userName.value
(or)
document.forms[0].userName.value; //based on number of forms.

Thanks
BVR.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic