Hello. The problem is that in the webform element on the designated function per click is not passed this.
Here is the control itself
<asp:CheckBox ID="chkTwoStepAute" onclick="agreeForm(this.form)" name="agree" runat="server" /> The event itself works, checked the alert, but I donβt want to send this. Form, Iβll put some simple HTML input next to it, everything works there and even the studio highlights this.
Here are two options, the original html and webform, on the original HTML everything works. Why not plow the transfer to webform?
<form> <input type="checkbox" name="agree" onclick="agreeForm3(this.form)"> <input type="radio" id="agree3" name="agree3" disabled> <input type="radio" id="agree2" name="agree2" disabled> </form> <script> function agreeForm3(f) { // ΠΡΠ»ΠΈ ΠΏΠΎΡΡΠ°Π²Π»Π΅Π½ ΡΠ»Π°ΠΆΠΎΠΊ, ΡΠ½ΠΈΠΌΠ°Π΅ΠΌ Π±Π»ΠΎΠΊΠΈΡΠΎΠ²Π°Π½ΠΈΠ΅ ΠΊΠ½ΠΎΠΏΠΊΠΈ if (f.agree.checked) { f.agree3.disabled = 0; f.agree2.disabled = 0; } // Π ΠΏΡΠΎΡΠΈΠ²Π½ΠΎΠΌ ΡΠ»ΡΡΠ°Π΅ Π²Π½ΠΎΠ²Ρ Π±Π»ΠΎΠΊΠΈΡΡΠ΅ΠΌ ΠΊΠ½ΠΎΠΏΠΊΡ else { f.agree3.disabled = 1; f.agree2.disabled = 1; f.agree3.checked = false; f.agree2.checked = false; } } </script> Option with web form
<form> <div class="col-md-7 marginleft"> <div class="col-md-3"> <asp:CheckBox ID="chkTwoStepAute" onclick="agreeForm(this.form)" name="agree" runat="server" /> </div> </div> <div class="col-md-7 marginleft margintop"> <div class="col-md-3"> <asp:RadioButton ID="EmailAut" GroupName="TwoFactor" Enabled="false" runat="server" name="rdbutton1" /> </div> </div> <div class="col-md-7 marginleft"> <div class="col-md-3"> <asp:RadioButton GroupName="TwoFactor" Enabled="false" ID="PhoneAut" runat="server" name="rdbutton2" /> </div> </div> </form> <script> function agreeForm(f) { if (f.agree.checked) { f.rdbutton1.disabled = 0; f.rdbutton2.disabled = 0; } else { f.rdbutton1.disabled = 1; f.rdbutton2.disabled = 1; f.rdbutton1.checked = false; f.rdbutton2.checked = false; } } </script>