Link to home
Start Free TrialLog in
Avatar of ronan_40060
ronan_40060Flag for United States of America

asked on

OnChange text Change

Hello Experts

Im writing a Small javaScript function that will change text Box name on change of Yes/No of Drop Down box Multiple Recipients
E.G
If Multiple Recipients Drop Down has  Yes then the text Box name below should have the name displayed Group Address else If No is selected then the text filed below has the nameCust Email Address.

I have attached the code snippete of what I have written so far  
 
Thanks in advanced
function function1(text) {
        var col = (text.options[text.selectedIndex].value);
        if (col) { 
           document.write('Cust Email Address'); 
        }
        alert("The Text has changed to "+col) 
    }

Open in new window

Avatar of neeraj523
neeraj523
Flag of India image

Hello

Your question is not very clear. Can you elaborate it a bit..

Are you looking to change the name of a textbox on the change event of drop down ?

neeraj523
Avatar of ronan_40060

ASKER

Neeraj
yes Im  looking to change the name of a textbox on the change event of drop down

Thanks
ASKER CERTIFIED SOLUTION
Avatar of neeraj523
neeraj523
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This is How my code looks like
function textChange(text)
{
        alert("inside Text Change Function");
        var col = (text.options[text.selectedIndex].value);
            alert(col)
        if (col == "true")
            {
           document.getElementById("custEmailAddress").name = "Group's Name:";
           document.getElementById("custEmailAddress").value = "'Group's Name:'";
            }
            else
            {
           document.getElementById("custEmailAddress").name = "Cust Email Address";
           document.getElementById("custEmailAddress").value = "Cust Email Address";
            }
}
Now when I call this function from JAVA FE with Drop down value changed to YES , Cust Email Address values gets populated in the text filed instead of changing the TextBox name
custEmailAddress is the id that Im using
I dont understand why you want to change the name of textbox on some event..

anyway.. value of the text box is changing because of
          document.getElementById("custEmailAddress").value = "'Group's Name:'";
       document.getElementById("custEmailAddress").value = "Cust Email Address";

lines.. i added these lines to show you how the things r changing.. if u delete these two lines.. value wont be changed..

any further info needed ??