DigitalFusionTom
asked on
Js to toggle readonly/disabled and value of form button
Hey all,
I have a form that I want the user to be able to click a button, then a form field becomes editable, and the button they clicked changes from saying Edit to Apply
function expenseToggle() {
if (this.form1.submit.value == "Edit") {
this.form1.submit.value == "Apply";
this.form1.AcctDist.disabl ed == False;
}
else {
this.form1.submit.value == "Edit";
this.form1.AcctDist.disabl ed == true;
}
}
form1:
<input value="" name="eAcctDist" disabled>
<input value="Edit" type="submit" name="submit" OnClick="expenseToggle()">
when I run this code, nothing even happens in FF, and IE the page refreshes faster than I can see the error.
I have a form that I want the user to be able to click a button, then a form field becomes editable, and the button they clicked changes from saying Edit to Apply
function expenseToggle() {
if (this.form1.submit.value == "Edit") {
this.form1.submit.value == "Apply";
this.form1.AcctDist.disabl
}
else {
this.form1.submit.value == "Edit";
this.form1.AcctDist.disabl
}
}
form1:
<input value="" name="eAcctDist" disabled>
<input value="Edit" type="submit" name="submit" OnClick="expenseToggle()">
when I run this code, nothing even happens in FF, and IE the page refreshes faster than I can see the error.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If you create a page with just this code it should work ( thats how i tested in the latest version of Chrome & Firefox ).
Please note that I changed the name of the form & the type of the button.
Please note that I changed the name of the form & the type of the button.
ASKER
hmm, your right...
ASKER
however, I need the button to be a type of submit after clicking apply so the server can process the input. I might have to look into doing this a different way.
ASKER
using the code u posted, I get no errors in IE or FF, but nothin happens when I click the "edit" button.