0

why i cant submit a form in asp when an object is disabled?

I have a form in an asp application that is validated by javascript and one of the conditions is disabling a textbox and when i want to submit the form its not submitted when the textbox is diasbled.

Any suggestions on how do i work around this to submit the form with the textbox disabled?

Thanks in advance

2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by dnanetwork
0

This is my javascript

<script type="text/javascript" >
    function DisBox() {
        if (document.form2.CbxAgree.checked) {
            document.form2.Districts.blur()
            document.form2.Districts.disabled = true
            document.form2.Delivery.disabled=true 
            document.form2.terms.disabled = true 
            document.form2.Button4.disabled = true

        }
        else {
            document.form2.Districts.disabled = false
            document.form2.Delivery.disabled = false 
            document.form2.specialterms.disabled = false 
            document.form2.Button4.disabled = false 

        }
    } 


    function validate() 
    {
        if (document.getElementById("Price").value == "") {
            alert("You have not entered value");
            document.getElementById("Price").focus()
        }
        else if (document.getElementById("Volume").value == "") {
            alert("You have not entered volume");
            document.getElementById("Volume").focus()
        }
        else if (document.form2.CbxAgree.checked==true  )
          {

              __doPostBack('Save', '')

        }
         else if(document.getElementById("Delivery").value == "") {
              alert("You have not entered Location");
              document.getElementById("Delivery").focus()
             }
        else if (document.getElementById("terms").value == "") {
              alert("You have not selected Delivery category");
              document.getElementById("Button4").focus()
             }
              else 
             {
              __doPostBack('Save', '')
             }

                   return false;
        }


</script>

Edited by mike_2000_17: Fixed formatting

0

run this thing in Firefox and check for the Error Console..
it display all the errors..

if there is any error...let me know..!

and your validation easily breakable..Enhance it more..
i can enter space in TextBox( Price,volume...etc) and pass myself through..

Edited by dnanetwork: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.