Hi,
I'm trying to set the value of a textbox with htmleditorextender with js.
I have this code:
function ValidatePayment() { var hiba = 0; var eloleg = document.forms["adv_paym"]["txtElolegosszeg"].value; if (eloleg == null || eloleg == "" || eloleg == "Kötelező mező!") { document.getElementById("txtElolegosszeg").setAttribute("class", "errortextbox"); document.getElementById("txtElolegosszeg").value = "Kötelező mező!"; hiba = hiba + 1; } var indoklas = document.forms["adv_paym"]["txtIndoklas"].value; if (indoklas == null || indoklas == "" || indoklas == "Kötelező mező!") { document.getElementById("txtIndoklas").setAttribute("class", "errortextbox"); document.getElementById('ctl00_ContentPlaceHolder1_txtIndoklas_HtmlEditorExtender_ExtenderContentEditable').innerHTML = "Kötelező mező!" hiba = hiba + 1; } if (hiba > 0) { return false; } }
But it doesn't work.
And curiously, it makes a postback, despite the fact, that the "hiba" variable is greater then 0.
If I remove the line with the htmleditorextender, it don't make a postback.
And here is the markup of the textbox:
<asp:TextBox ID="txtIndoklas" runat="server" CssClass="mytextbox2" Height="200px" TextMode="MultiLine" Width="500px"></asp:TextBox><asp:HtmlEditorExtender ID="txtIndoklas_HtmlEditorExtender" runat="server" Enabled="True" TargetControlID="txtIndoklas" EnableSanitization="false"></asp:HtmlEditorExtender>