Link to home
Start Free TrialLog in
Avatar of DigitalFusionTom
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.disabled == False;
    }
   else {
       this.form1.submit.value == "Edit";
       this.form1.AcctDist.disabled == 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.


ASKER CERTIFIED SOLUTION
Avatar of MaartenHensen
MaartenHensen
Flag of Belgium 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
Avatar of DigitalFusionTom
DigitalFusionTom

ASKER

thanks for the post.  


using the code u posted, I get no errors in IE or FF, but nothin happens when I click the "edit" button.  
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.
hmm, your right...

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.