...

View Full Version : linking to a history page in html



hmvrulz
01-11-2008, 04:38 PM
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....

ahallicks
01-11-2008, 04:58 PM
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 :-)

hmvrulz
01-11-2008, 05:00 PM
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

hmvrulz
01-11-2008, 05:05 PM
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


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

ahallicks
01-11-2008, 05:05 PM
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 (http://www.plus2net.com/javascript_tutorial/javascript_validation.php)

ahallicks
01-11-2008, 05:06 PM
i used this n it worked... tahnx for the reply


<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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum