• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Queries on form validation in html using javascript.

 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi experts,
1)How can I put the Username: ,Password: and Submit: button in the center alignment of the page within a square box and bold border surrounding it?Any sample codes can be helpful.
2)Can someone suggest me how can I correct this in my below code? I want the validation to happen first and then then if it is passing the validation, then the user can move to next page. Currently it is moving to the next page "index.html" on click of submit button.

 
Sheriff
Posts: 67590
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Firstly, be sure to indent your HTML code properly. That's all just a big mess that's really hard to inspect.

Foni kumar wrote:
1)How can I put the Username: ,Password: and Submit: button in the center alignment of the page within a square box and bold border surrounding it?


Seems like straightforward CSS. Give it a try and see how close you can get with it.

2)Can someone suggest me how can I correct this in my below code? I want the validation to happen first and then then if it is passing the validation, then the user can move to next page. Currently it is moving to the next page "index.html" on click of submit button.


You'd bind a submit handler to the form, which will be triggered then the form submits. If you're checking fails, return the value false and the form submission will abort. If you return true, the form will continue to submission. It looks as if you're close to doing that; what's the specific problem?

Also, using jQuery for all this is much easier than raw JavaScript.
 
author
Posts: 297
5
Android Firefox Browser Fedora
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your ContactForm does not have userid field, so ValidateContactForm will always fail to return a value and the form submit process will continue.

Also you have two head elements and two body elements, that's never going to end well.
 
You’ll find me in my office. I’ll probably be drinking. And reading this tiny ad.
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic