PDA

View Full Version : Tricky Text edit control qn.


vijk2001
08-12-2002, 05:29 PM
HI ..

I have two text edit controls on my HTML form

Link Name-entered by user on Form

Link Type- (If Link Name >=4 chars , Link Type = 1st 4 chars of
the Link Name)
- (If Link Name <4 chars ,Link Type =Link Name appended
by O)

How to do so that when entering input in one field the other gets populated based on what is entered in one field.
PLs help

A1ien51
08-13-2002, 05:51 AM
okay this is a javascript question here:'

basically here is what you need to look at

<html>
<head>
<script>
function ChangeIt(){
NT=document.F1.T1.value;
if(NT.length>=4){
NT=NT.slice(0,4);
}
else{
NT+="OOOOO";
NT=NT.slice(0,4);
}
document.F1.T2.value=NT;
}
</script>
</head>
<body>
<form name="F1">
<input type="text" value="" name="T1" onblur="ChangeIt()">
<input type="text" value="" name="T2" onblur="ChangeIt()">
</form>
</body>
<html>