Link to home
Start Free TrialLog in
Avatar of WEhalt
WEhaltFlag for United States of America

asked on

Java select entire value in form field

How do I select the entire value in the field in addition to setting focus as I have below.

        function DynamCkTextBox(thisTextBox) {
            var dVal = 0;

            if (isNaN(thisTextBox.value)) {
                thisTextBox.focus();
                alert('"' + thisTextBox.value + '" is not a valid value for field ' + thisTextBox.id);
                //thisTextBox.style.backgroundColor = "Yellow"
                return false;
            }
            //thisTextBox.style.backgroundColor = "White"
            dVal = Number(thisTextBox.value);
            thisTextBox.value = dVal.toFixed(2);
            return true;
        }
Avatar of Alfredo Luis Torres Serrano
Alfredo Luis Torres Serrano
Flag of United States of America image

Textbox1.Focus
Textbox1.SelStart=0
Textbox1.Selend = Len(textbox1.text)
ASKER CERTIFIED SOLUTION
Avatar of Alfredo Luis Torres Serrano
Alfredo Luis Torres Serrano
Flag of United States of America 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