Lisa
Lisa

Reputation: 3181

How can I post the label

I'm working on sending the following string as HTML content to a component to use it as an inner HTML content:

 <script type="text/javascript">

 var value;


 //Component definition

  html:  '<% using (Html.BeginForm("archExp", "Explorer", FormMethod.Post, new { id = "Submit" })) { %> <p> Please specify Directory name</p> 
    <label for="name">Name:</label> <%=  Html.TextBox("name") %> <br /><br /> 
    <label for="name">Parent:'+value+' </label>  
    <div class="form-actions"> <button type="submit" class="t-button">Submit !</button></div> <% } %>'

The form contained in the previous HTML string has to POST the text filled inside the textBox as well as the value appears in label element, but it's not doing that?!?

P.S. archExp is the view and Explorer is the controller

Upvotes: 0

Views: 88

Answers (1)

Erik Funkenbusch
Erik Funkenbusch

Reputation: 93424

You can only post input types (not counting querystring values). Label is not an input type. Therefore, you can't post a label.

You could save the data in a hidden input field, as well as placing it in the label.

Upvotes: 1

Related Questions