Page 1 of 1
track content of the form
Posted: Fri Jul 18, 2008 2:54 am
by junjustkim
Hi to all
How can I track that if the user attempt to click any button or input value in any field then I will remind them to login first if not yet log.
Thanks in advance
Tirso
Re: track content of the form
Posted: Fri Jul 18, 2008 4:39 am
by irfan798
You can use javascript whit php
use them
For example:
Code: Select all
<input name="" onchange="attempt();" type="text" />
Javascript
x=1;
<?
And use php for looking if user login like
If (user login) { echo "x=2;";}
?>
if(x=1) {define function attempt() here} else {again define function attempt() here}
Javascript
Look this links:
http://tr2.php.net/manual/en/book.session.php
http://www.w3schools.com/JS/js_functions.asp
Re: track content of the form
Posted: Fri Jul 18, 2008 5:09 am
by junjustkim
HI,
thanks for your immediate replied, Bu do i need to put this javascript "onchange,onclick,onfocus" to all my field and button like your example (<input name="" onchange="attempt();" type="text" />). I have a lot of field and button to my forms.
Thanks
Tirso
Re: track content of the form
Posted: Fri Jul 18, 2008 5:28 am
by dhrosti
this is a javascript question really, but anyway...
you can use a for loop to assign event handlers to all your input elements in a few lines...
Code: Select all
function assignHandlers() {
var inputs = document.getElementsByTagName('input');
for (var i=0; i<inputs.length; i++) {
inputs[i].onclick = attempt;
}
}
window.onload=assignHandlers;
Re: track content of the form
Posted: Fri Jul 18, 2008 5:45 am
by junjustkim
Thank you so much for your time and effort, It was contributed a lot for me. Now I would continued my development for almost 3 days hang up.
Again, thank you so much
Tirso