Clear HTML Tags Before Submit

2 posts, 0 answers
  1. Trevor
    Trevor avatar
    13 posts
    Member since:
    Jun 2011

    Posted 21 Jun 2012 Link to this post

    I've been stuck on this problem for a few hours now.
    I need to save the value of a textbox on a form on ASPX Child Page which may contain html markup. The page also contains multiple Formviews bound to different datasources.
    When I try and submit I get a "potentially dangerous request" error.  I tried setting ValidateRequest="false" in the page header, but to no avail.
    I assume the answer would be to strip the tags from the value before posting back to the server in javascript, but I cannot figure out a way to make the form perform a submit operation.  I tried the page.submit() ; but it did nothing. And when I tried using the form control I get a javascript error stating submit is not a function.

    asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
         <asp:FormView ID="TwoWeekForm" runat="server" DataSourceID="TwoWeekDataSource"
            DataKeyNames="ID" >
                    <asp:TextBox ID="TwoWeekText" runat="server" Text='<%# Bind("Extended") %>' TextMode="MultiLine" CssClass="KeyEvent" style="color:Black"></asp:TextBox>

    <telerik:OpenAccessDataSource ID="TwoWeekDataSource" runat="server"
           EnableDelete="False" EnableInsert="False"
           ObjectContextProvider="CNTracker.OpenAccess.EntitiesModel, CNTracker.OpenAccess"
           Where="this.Project == @Project AND this.Type == 17">
               <asp:SessionParameter DefaultValue="1" Name="Project"
                   SessionField="CurrentProject" />
  2. Ady
    Ady avatar
    589 posts

    Posted 26 Jun 2012 Link to this post

    Hi Trevor,

     You should add the following entry to your web.config and it should fix the error

         <httpRuntime requestValidationMode="2.0"/>

    Hope this helps. Do get  back in case you need further assistance.

    Kind regards,
    the Telerik team
    OpenAccess ORM Q2'12 Now Available! Get your hands on all the new stuff.
Back to Top