user3214892
user3214892

Reputation: 147

Name attribute gets removed from FORM tag in .NET

How do I make sure .NET does not remove the NAME attribute from my HTML forms. I require this in order to use AngularJS. Please let me know.

in visualstudio my form looks like this:

<form id="scheduleFrm" name="scheduleFrm" runat="server">

but it ends up looking like this in my browser's source:

<form id="scheduleFrm" method="POST"> without the name attribute

AngularJS needs the name attribute but name is available for my form

Upvotes: 4

Views: 1352

Answers (2)

user875234
user875234

Reputation: 2517

This is bad but it will get you going again:

<form id="theName" ...>
    <script>document.getElementById("theName").setAttribute("name", "theName");</script>
    <!-- ...formalities -->
</form>

Upvotes: 2

Alexandre TRINDADE
Alexandre TRINDADE

Reputation: 947

There is an workaround. If you do for example:

$scope.scheduleFrm...

to access your form, so you can do:

var formName = $("#scheduleFrm").attr("name");
$scope[formName]...

to do the same.

Upvotes: 0

Related Questions