File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Empty Form Checking Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Empty Form Checking" Watch "Empty Form Checking" New topic
Author

Empty Form Checking

Debojit Sinha
Ranch Hand

Joined: Mar 13, 2010
Posts: 66

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

Joined: Jan 30, 2011
Posts: 329

So what have you tried and where are you stuck?


Have Fun with Java
little,little.. little by little makes a lot..
Debojit Sinha
Ranch Hand

Joined: Mar 13, 2010
Posts: 66

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

Joined: Oct 14, 2010
Posts: 218
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.


Thanks
Vipul Kumar
Debojit Sinha
Ranch Hand

Joined: Mar 13, 2010
Posts: 66

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

Joined: Oct 14, 2010
Posts: 218
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Empty Form Checking
 
Similar Threads
On click of a Button i eneed to call a JSP Page
from form to servlet to jsp
newbie form submit question
Cab you Post using a link ? dont want to use "get"
how to add values to servlet and call that servlet