hi,
im new to struts2..in my application i need to use that Struts2 concept..im developing jsp page..i had designed..drop-down box in jsp..if im doing validation it is not getting..and it is not getting validated..can any one help me out..
login.jsp
Also, when posting in the HTML/JavaScript forum, please show only the rendered HTML--JSP is useless to us. You may find that looking at the rendered HTML is enough to solve your problem. Plus your JavaScript is wrong anyway, unless you really want a user to be able to select the header label as a legal value.
This message was edited 2 times. Last update was at by David Newton
madhuri kunchala
Ranch Hand
Joined: Mar 30, 2010
Posts: 350
posted
0
ok..here is my coding
login.jsp
login.js
any help why it is not validating
David Newton
Author
Rancher
Joined: Sep 29, 2008
Posts: 12612
posted
0
I think you misunderstood what I meant when I said "post the rendered HTML". You just posted more *more* JSP, which is kind of the opposite of what is useful.
madhuri kunchala
Ranch Hand
Joined: Mar 30, 2010
Posts: 350
posted
0
i had done coding in jsp i didnt used html pages
David Newton
Author
Rancher
Joined: Sep 29, 2008
Posts: 12612
posted
0
...
Clients (browsers) don't render JSP. They render HTML. HTML is what gets sent from the server to the client. HTML is what JavaScript acts on.
Post the rendered HTML.
madhuri kunchala
Ranch Hand
Joined: Mar 30, 2010
Posts: 350
posted
0
i tried by entering the textfield in jsp using 's' prefix it is validating but not with drop-down box..and the html code is
David Newton
Author
Rancher
Joined: Sep 29, 2008
Posts: 12612
posted
0
So, the rendered HTML *does* give you a clue why your JavaScript doesn't work as you expect--right?
madhuri kunchala
Ranch Hand
Joined: Mar 30, 2010
Posts: 350
posted
0
i m not getting your point and help me where the code gets wrong.
David Newton
Author
Rancher
Joined: Sep 29, 2008
Posts: 12612
posted
0
What's the id of the select element?
madhuri kunchala
Ranch Hand
Joined: Mar 30, 2010
Posts: 350
posted
0
id of the select element is uploadtextContType..even if i had given..also it is not getting validated
This message was edited 1 time. Last update was at by madhuri kunchala
David Newton
Author
Rancher
Joined: Sep 29, 2008
Posts: 12612
posted
0
Do you know how to debug JavaScript?
madhuri kunchala
Ranch Hand
Joined: Mar 30, 2010
Posts: 350
posted
0
i dont have any idea..can you tell me how to do.
madhuri kunchala
Ranch Hand
Joined: Mar 30, 2010
Posts: 350
posted
0
hi good morning,
any help regarding my post why the drop-down is not getting validated.
thanks,
madhu.
madhuri kunchala
Ranch Hand
Joined: Mar 30, 2010
Posts: 350
posted
0
i tried by entering the textfield..it is getting validated..but im facing problem with select box..is there any way to code..can anyone help me out..
madhuri kunchala
Ranch Hand
Joined: Mar 30, 2010
Posts: 350
posted
0
i had changed my code and following is my jsp page..can any one help me why Select option is not getting validated.
and rendered Html file is
and corresponding login.js page
can any one provide me the solution.
thanks,
madhu.
David Newton
Author
Rancher
Joined: Sep 29, 2008
Posts: 12612
posted
0
Wouldn't it be cleaner to use a regex for the textfield validation? Or at least refactor out the validation code into its own method?
madhuri kunchala
Ranch Hand
Joined: Mar 30, 2010
Posts: 350
posted
0
hi,
i tried this way for validation of combo box but im getting validated..here is the code.
madhuri kunchala
Ranch Hand
Joined: Mar 30, 2010
Posts: 350
posted
0
hi good morning,
i m unable to do validation for select statement..i tried so many times..but im not getting ..here is the code..can any one help me out.
David Newton
Author
Rancher
Joined: Sep 29, 2008
Posts: 12612
posted
0
Works fine for me. I still think you should use a regex for that file thing though.
How will you be uploading the file without a file input?
This message was edited 1 time. Last update was at by David Newton
madhuri kunchala
Ranch Hand
Joined: Mar 30, 2010
Posts: 350
posted
0
hi David,
i tried to validate 'combobox' in normal jsp page it is working fine but not it in Struts2.You told it is working fine for you..my code is working fine for you and why not for me?have you done any changes..if so can you provide me the solution.
David Newton
Author
Rancher
Joined: Sep 29, 2008
Posts: 12612
posted
0
I ran your code against what you said was the generated HTML. It worked. I didn't change anything.
madhuri kunchala
Ranch Hand
Joined: Mar 30, 2010
Posts: 350
posted
0
k..for me why it is not getting..here are the files..can you check it and provide me the solution
uploadText.jsp
rendered HTML Page is
UploadText.js
where i went wrong can you provide me the solution for my post
David Newton
Author
Rancher
Joined: Sep 29, 2008
Posts: 12612
posted
0
I don't see how this is significantly different. Did you put a breakpoint or alert or console log to see if it's even getting to the code that validates the select?
madhuri kunchala
Ranch Hand
Joined: Mar 30, 2010
Posts: 350
posted
0
i checked..till 'TextFile'..it is getting validated..and it is not getting validated for combo box..for Struts2 is there any other way for client side validation for Select statement
This message was edited 1 time. Last update was at by madhuri kunchala
David Newton
Author
Rancher
Joined: Sep 29, 2008
Posts: 12612
posted
0
David Newton wrote:I don't see how this is significantly different. Did you put a breakpoint or alert or console log to see if it's even getting to the code that validates the select?
subject: unable to do validation for select in struts2