Thursday, May 23, 2024
 Popular · Latest · Hot · Upcoming
4
rated 0 times [  10] [ 6]  / answers: 1 / hits: 87768  / 13 Years ago, tue, december 13, 2011, 12:00:00

I wanna know how do I enable a disabled form text field on submit. Also I wanna make sure if user goes back to form or click reset field will show again as disabled.



I tried to use



document.pizza.field07.disabled = false ;


It does disables the field, by clicking reset or hitting back button still keeps it enable.



Please guide.


More From » html

 Answers
59

To access this element in a more standard way, use document.getElementById with setAttribute



document.getElementById(field07).setAttribute(disabled, false);


EDIT



Based on your comment, it looks like field07 is a name, not an id. As such, this should be what you want:



var allfield7s = document.getElementsByName(field07);
for (var i = 0; i < allfield7s.length; i++)
allfield7s[i].setAttribute(disabled, false);

[#88590] Sunday, December 11, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
nicholas

Total Points: 188
Total Questions: 76
Total Answers: 103

Location: Honduras
Member since Sun, Dec 26, 2021
2 Years ago
nicholas questions
;