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

Recommended Answers

All 3 Replies

show my your markup/..

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>

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..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.