dcsimg
www.webdeveloper.com
Results 1 to 7 of 7

Thread: validation

  1. #1
    Join Date
    Oct 2017
    Posts
    30

    validation

    Failed to load resource: net::ERR_FILE_NOT_FOUND
    /resources/demos/style.css Failed to load resource: net::ERR_FILE_NOT_FOUND
    contactme.html:105 Uncaught SyntaxError: Invalid or unexpected token
    contactme.html:48 Uncaught ReferenceError: Email is not defined
    at checkForm (contactme.html:48)
    at HTMLInputElement.onclick (contactme.html:112)
    Code:
    
    

  2. #2
    Join Date
    Oct 2017
    Posts
    30
    I am not able to post the code. Why?

  3. #3
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    5,536
    IDK, did it give you an error? Sometimes it doesn't like certain things, so try a smaller code block.

    If you are looking to use JavaScript for validation, apart from trying to get the right information in to the form fields, HTML5 has had some advances that now do most of the legwork without any javascript involvement.

    What you will be able to use javascript for is support for those die hard old browser users like the older HTML4 browsers. There are a couple of HTML5 browsers that are not playing ball, Safari is dragging its heels for the people who were first off the blocks, they have been left behind by the other browsers like firefox, MISE and Chrome who were the last to adopt HTML5 but are the leaders in support for the markup.

    JavaScript can also be disabled, because of this, you would still have to validate the incoming data on the server to ensure that its not trying to hack the site.
    --> JavaScript Frameworks like JQuery, Angular, Node <--
    ... and please remember to wrap code with forum BBCode tags:-

    [CODE]...[/CODE] [HTML]...[/HTML] [PHP]...[/PHP]

    If you can't think outside the box, you will be trapped forever with no escape...

  4. #4
    Join Date
    Oct 2017
    Posts
    30
    Thank You!

  5. #5
    Join Date
    Oct 2017
    Posts
    30
    How can i call the (index.html) file onClick of a button?
    <button type="button" class="btn btn-outline-success" onClick="index.html">Home</button> --- is this correct. not working.
    Thank You

  6. #6
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    5,536
    No, it wouldn't work because the event handler is triggered and calls or runs any script it finds and and a string caller index.html is not a function nor is it a piece of code.

    <a tags exist just for this purpose and its what its for, if you really wanted a button to control the next page, then you need to use a web form and have the action attribute point to the page you want and a <button tag is not the same as using a <input tag that is designated a submit button.

    HTML Code:
    <form name="gohere" action="index.html" method="get" enctype="application/x-www-form-urlencoded" >
        <input name="where" type="hidden" value="index">
        <input name="Submit" type="submit" value="Index">
    </form>
    and the URL would then carry a query string over to the next page should you wish to read it.

    When it comes to links, you should also avoid relying on JavaScript to control the clicks, there are plenty of text based browser users as well as users who still to date use browsers that do not support javascript or have javascript turned off for various reasons, so from a developer standpoint, this reliance on using JS to control links means that should your visitor find you, your site to them would appear to not work and they would move on very quickly.
    --> JavaScript Frameworks like JQuery, Angular, Node <--
    ... and please remember to wrap code with forum BBCode tags:-

    [CODE]...[/CODE] [HTML]...[/HTML] [PHP]...[/PHP]

    If you can't think outside the box, you will be trapped forever with no escape...

  7. #7
    Join Date
    Oct 2017
    Posts
    30
    In Home page , i have 2-3 buttons , So 2-3 forms with different actions? also how to show when i click contact.html,it opens on home page? Thank You

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center