View Full Version : tips on what I am meant to search for please

09-18-2009, 07:50 PM

I can;t think what to search for but I need the following.

I am running a form and if data is entered to the first text box, I want a warning message to show up, if they try to add data to any one of several other textboxes.

tips on search terms would be great or a link to what might be some loosely appropriate code.


Philip M
09-18-2009, 08:05 PM
Try this:-

1 <input type = "text" id = "box1"><br>
2 <input type = "text" id = "box2" value = "Some text in box 2" onfocus = "stop()"><br>
3 <input type = "text" id = "box3" value = "Some text in box 3" onfocus = "stop()"><br>
4 <input type = "text" id = "box4" value = "Some text in box 4" onfocus = "stop()"><br>

<script type = "text/javascript">
function stop() {
if (document.getElementById("box1").value.length > 0) {
alert ("You may not alter the content of this field while box 1 contains anything");
document.getElementById("box1").focus(); // set the focus away from box2-4
document.getElementById("box1").blur(); //and suppress it
return false;

"If you don't read the newspaper, you are uninformed; if you do read the newspaper, you are misinformed." - Mark Twain

09-18-2009, 08:26 PM
Thank you Philip.

I'll try that out.

Since posting, I had got as far as dynamic form validation but not yet to any appropriate results.

I really must begin to learn js soon.