Web Analytics Made Easy -
StatCounter disable element in form - CodingForum

Announcement

Collapse
No announcement yet.

disable element in form

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • disable element in form

    how can i disable submit button on form until all required fileds filled and also filed correctly ... second i want to know how to disable element such as textbox or drop down menu or button based on checkbox value hmmmm on more thing how can i change the color of table row based on check box value
    Last edited by mohamed_nagy; Feb 20, 2004, 11:47 PM.

  • #2
    For your 2nd problem:

    Code:
    <head>
    <script type="text/javascript">>
    <!--hide
    function dis() {
    document.formName.ElementName.disabled='true'
    }
    //-->
    </script>
    <script type="text/javascript">>
    <!--hide
    function open() {
    document.formName.Elementname.disabled='false'
    }
    //-->
    </script>
    <form name="formName"><input type=radio onClick="dis()">
    <input type=radio onClick="open()">
    <input type=button name="ElementName" disabled="false">
    </form>
    You could merge those scripts into one if you want. They way I have it set up it would be better to use radio buttons. If you really want to use checkboxes try:
    Code:
    <script type="text/javascript">
    <!--hide
    function doit() {
    if (document.formName.checkBoxName.selected="true") {document.formName.elementYouWantToAccessName.disabled=false};
    else {document.formName.elementYouWantToAccessName.disabled=true}
    }
    //-->
    </script>

    For your third problem just do <input type=checkbox onClick="document.getElementById('tableCellId').bgColor='blue'">

    ...or you can use a submit button by using another "if selected" type function.
    Last edited by Bobo; Feb 21, 2004, 12:00 AM.
    Oh, was I supposed to put something here? ........

    Comment

    Working...
    X