This is a migrated thread and some comments may be shown as answers.

Clear HTML Tags Before Submit

1 Answer 73 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Trevor
Top achievements
Rank 1
Trevor asked on 21 Jun 2012, 06:07 PM

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" >
    <ItemTemplate>
 ...
    </ItemTemplate>
    <EditItemTemplate>
 ...
                <asp:TextBox ID="TwoWeekText" runat="server" Text='<%# Bind("Extended") %>' TextMode="MultiLine" CssClass="KeyEvent" style="color:Black"></asp:TextBox>
 ...   
    </table>
    </EditItemTemplate>
...  
    </asp:FormView>

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

1 Answer, 1 is accepted

Sort by
0
Ady
Telerik team
answered on 26 Jun 2012, 01:34 PM
Hi Trevor,

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

<system.web>
     <httpRuntime requestValidationMode="2.0"/>
</system.web>

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

Kind regards,
Ady
the Telerik team
OpenAccess ORM Q2'12 Now Available! Get your hands on all the new stuff.
Tags
General Discussions
Asked by
Trevor
Top achievements
Rank 1
Answers by
Ady
Telerik team
Share this question
or