Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder
    Join Date
    Jan 2007
    Posts
    137
    Thanks
    5
    Thanked 0 Times in 0 Posts

    linking to a history page in html

    i wanna link to the previous page that is History - 1
    so that the forum filled up in the previous page is not reset....

    on the present page i wanna validate the forum.. if anything not filled i wanna give a link to the previous page so tht on clicking no fields are reset and neccesary cahnges are done....

  • #2
    Senior Coder ahallicks's Avatar
    Join Date
    May 2006
    Location
    Lancaster, UK
    Posts
    1,134
    Thanks
    1
    Thanked 57 Times in 55 Posts
    So you want some form validation? There are a few ways you could go about it. Javascript can check the form on the page before it is submitted so works quite well for this as you don't have to navigate away from the page and the form won't be submitted until validation is passed. Requires javascript to be enabled, however. With javascript you can also use some form of server-side markup that will also check the form. I use php, which is fairly easy for this kind of thing... you just need a server that has php enabled and a good tutorial that you will be able to find VERY easily on google.

    There are various other ways, but these two work best for me :-)
    "write it for FireFox then hack it for IE."
    Quote Originally Posted by Mhtml View Post
    Domains are like women - all the good ones are taken unless you want one from some foreign country.
    Reputation is your friend

    Development & SEO Tools

  • #3
    Regular Coder
    Join Date
    Jan 2007
    Posts
    137
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by ahallicks View Post
    So you want some form validation? There are a few ways you could go about it. Javascript can check the form on the page before it is submitted so works quite well for this as you don't have to navigate away from the page and the form won't be submitted until validation is passed. Requires javascript to be enabled, however. With javascript you can also use some form of server-side markup that will also check the form. I use php, which is fairly easy for this kind of thing... you just need a server that has php enabled and a good tutorial that you will be able to find VERY easily on google.

    There are various other ways, but these two work best for me :-)
    can u please tell me how to do it via java script


    how to add the HREF part ??? i have seen a few pages on the net.. been a long time since i coded my last page.. so finding it hard to remember

  • #4
    Regular Coder
    Join Date
    Jan 2007
    Posts
    137
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by ahallicks View Post
    So you want some form validation? There are a few ways you could go about it. Javascript can check the form on the page before it is submitted so works quite well for this as you don't have to navigate away from the page and the form won't be submitted until validation is passed. Requires javascript to be enabled, however. With javascript you can also use some form of server-side markup that will also check the form. I use php, which is fairly easy for this kind of thing... you just need a server that has php enabled and a good tutorial that you will be able to find VERY easily on google.

    There are various other ways, but these two work best for me :-)
    i used this n it worked... tahnx for the reply

    Code:
    <a href="javascript:history.go(-1)">

  • #5
    Senior Coder ahallicks's Avatar
    Join Date
    May 2006
    Location
    Lancaster, UK
    Posts
    1,134
    Thanks
    1
    Thanked 57 Times in 55 Posts
    Code:
    Put in the head:
    
    <script type="text/JavaScript">
    <!--
    function validate() {
    	if(document.form1.textinput.value=='')
    		{
    		alert('Fill the Input box before submitting');
    		return false;
    		}
    	
    	else	{
    		return true;
    			}
    }
    //-->
    </script>
    
    And your form:
    
    <form name="form" action="thispage.php" method="post" 
    				onSubmit="return validate();" id="form" />
    Input : <input type="text" name="textinput" value="" />
    <input type="submit" value="submit" />
    </form>
    Obviously for php purposes you need to submit the form to the same page so that it can handle all of the inputted text. Also note that with a strict XHTML doctype you will need to remove the 'name' from the <form> and replace the javascript using document.getElementById('form');

    All you have to do is create an if for each input you would like to validate. This is a quick example I got from the web, so read more here
    "write it for FireFox then hack it for IE."
    Quote Originally Posted by Mhtml View Post
    Domains are like women - all the good ones are taken unless you want one from some foreign country.
    Reputation is your friend

    Development & SEO Tools

  • #6
    Senior Coder ahallicks's Avatar
    Join Date
    May 2006
    Location
    Lancaster, UK
    Posts
    1,134
    Thanks
    1
    Thanked 57 Times in 55 Posts
    Quote Originally Posted by hmvrulz View Post
    i used this n it worked... tahnx for the reply

    Code:
    <a href="javascript:history.go(-1)">
    Fair enough... that would be the simple way to do it... but it won't validate the form and will not work with javascript disabled and you will need to think of the people browsing your site that don't use javascript. There are more than you think
    "write it for FireFox then hack it for IE."
    Quote Originally Posted by Mhtml View Post
    Domains are like women - all the good ones are taken unless you want one from some foreign country.
    Reputation is your friend

    Development & SEO Tools


  •  

    Posting Permissions

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