Function didn't get validated
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
How to include onsubmit to return or validate two functions?
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Experience keeps a dear School, but Fools will learn in no other.
---
Benjamin Franklin - Postal official and Weather observer
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Gayathri Gayu wrote:Instead of validating the function I just added the required in the text fields.
Note that "required" only works for HTML5-compliant web clients. HTML4 did not support this feature. So, for example, IE9 and earlier, this won't work.
Experience keeps a dear School, but Fools will learn in no other.
---
Benjamin Franklin - Postal official and Weather observer
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Also you still have multiple fields with the same id (user and pass). This is wrong.
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Dave Tolls wrote:
Also you still have multiple fields with the same id (user and pass). This is wrong.
In fact, this is a violation of proper XML document formation. The XML spec, of which HTML specs are derivative, says that each element must have a unique id value. Failure to observe this restriction can have unpredictable results. Especially if you start browsing the DOM using get element by ID.
And, as Dave has said. Using 1 form to do the work of 2 is not a good idea. Also, forms cannot be nested, so don't even think of doing that!
Experience keeps a dear School, but Fools will learn in no other.
---
Benjamin Franklin - Postal official and Weather observer
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
And when the user tries to sign-in with empty username and password field, it should alert the else if condition only. How will i validate this? Please help me.
Added the servlet code and how the form looks for your reference.
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
What do you mean by the id values are unique?Bear Bibeault wrote:You don't seem to be heeding the advice to split your form into two separate forms. Or to be sure that your id values are unique.
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
You can share code with smaller functions, but for now concentrate on getting the structure correct. Optimizations can come later.
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Gayathri Gayu wrote:What do you mean by the id values are unique?
You have multiple elements withe the same id value ("user" for example). That's not valid HTML.
My advice would be to use class names instead of id values to identify the fields; but if you are going to use id values, they must be unique within the entire HTML page.
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Bear Bibeault wrote:You should have one form inside your sign-in-htm div, and another inside the sign-up-htm. Each should have their own validation function, and each should be processed by a different servlet controller.
You can share code with smaller functions, but for now concentrate on getting the structure correct. Optimizations can come later.
So i should have separate for like for sign-up . Is this correct?
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Swastik
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Gayathri Gayu wrote:Is this correct?
Assuming those servlets do what you need, then yes.
But you still need to rename your clashing id fields (user and pass).
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Swastik Dey wrote:What is happening now? Are you getting desired output?
No i am not getting the desired output. So I just kept one servlet.
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Dave Tolls wrote:
Gayathri Gayu wrote:Is this correct?
Assuming those servlets do what you need, then yes.
But you still need to rename your clashing id fields (user and pass).
As I didn't get the desired output, i just merged both to one file. Should i need to rename the user and pass for either sign-up-htm or sign-in-htm?
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
The above code how will i display the login page in a popup while clicking login button?
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
As Tim said earlier, XML requires you to have unique id values to be valid.
Besides, you are still using a single form for two actions.
Sign-up is not the same thing as Sign-in.
| Do not meddle in the affairs of dragons - for you are crunchy and good with ketchup. Crunchy tiny ad: Paul Wheaton's 16th Kickstarter: Gardening playing cards for gardeners and homesteaders https://coderanch.com/t/889615/Paul-Wheaton-Kickstarter-Gardening-playing |













