mumbojumbo
05-27-2012, 11:08 AM
My first javascript problem:
I have a php script with multiple forms. Each form holds only one text field and a submit button.
If the user places the cursor in a text field below and add text, but then forget to submit that form and instead click a text field in another forms text field ("onbluring" the first forms text field) the text that was typed in the first forms text field will disapeare.
To warn the user I would like to add some code that when the user is leaving the text field in a form without having submitted the form warns the user of this.
It's would be nice if the user is warned only if the text field that's leaved holds text.
I understand that I must learn Javascript but since I don't now OOP yet, I ask for help begging on my bare knees. Please have mercy, I'm just a simple procedural PHP programmer.
<form action="'.$_SERVER['PHP_SELF'].'" method="post">
First name: <input type="text" name="fn" />
<input type="submit" value="Register" />
</form>
<form action="'.$_SERVER['PHP_SELF'].'" method="post">
Last name: <input type="text" name="ln" />
<input type="submit" value="Register" />
</form>
I have a php script with multiple forms. Each form holds only one text field and a submit button.
If the user places the cursor in a text field below and add text, but then forget to submit that form and instead click a text field in another forms text field ("onbluring" the first forms text field) the text that was typed in the first forms text field will disapeare.
To warn the user I would like to add some code that when the user is leaving the text field in a form without having submitted the form warns the user of this.
It's would be nice if the user is warned only if the text field that's leaved holds text.
I understand that I must learn Javascript but since I don't now OOP yet, I ask for help begging on my bare knees. Please have mercy, I'm just a simple procedural PHP programmer.
<form action="'.$_SERVER['PHP_SELF'].'" method="post">
First name: <input type="text" name="fn" />
<input type="submit" value="Register" />
</form>
<form action="'.$_SERVER['PHP_SELF'].'" method="post">
Last name: <input type="text" name="ln" />
<input type="submit" value="Register" />
</form>