0

I am using JQuery to update some input values - and on the screen it looks as if the values are being set properly.

I am doing this:

 var company = $('[id$=' + idTag + ']');
                            if (company) {
                                company.val(ret.CompanyDocTitle);
                                company.attr("DocumentGuid", ret.CompanyDocumentGuid);
                            }

I can see the input text field getting set - so I know it has value.

When I go to save the information (Posting to ASPX page) when I try to retrieve the Text of my input box, its coming up blank

myobjtext = P1bRespComp.text

my aspx page is using a TextBox

<asp:TextBox ID="P1bRespComp" runat="server" ></asp:TextBox>

any thoughts on this?

EDIT Found the issue I think - my INPUT field is marked as Disabled to prevent users from entering data in there - however - I do want the Value and other Attributes - Is there a way I can get the Update value and attributes on this disabled INPUT field?

Nutshell
  • 197
  • 2
  • 2
  • 11

1 Answers1

0

You can improve your js using this:

$('#'+ idTag )
   .val(ret.CompanyDocTitle)
   .attr("DocumentGuid", ret.CompanyDocumentGuid);

Jquery only set value and attribute if the element exist.

I think you have to set the "name" attr in ASP.

<asp:TextBox ID="P1bRespComp" name="P1bRespComp" runat="server"
></asp:TextBox>
Martin Borthiry
  • 5,256
  • 10
  • 42
  • 59
  • @Marting Thanks for the response in asp the name is dynamically generated - and converts the TextBox to an INPUT element. I can see the values getting set, and if I do not have a 'disabled' INPUT the values do get passed. I have also tried making it readonly as suggested on another link - but that is also not passing the data. – Nutshell Nov 11 '11 at 18:30
  • ***EDIT*** I do see on the POST via Fiddler that my values are being sent - so it has to do asp not setting the values or not part of the _VIEWSTATE Any Help? – Nutshell Nov 11 '11 at 19:10
  • found the answer - this is a ASP issue - [link](http://stackoverflow.com/questions/1060518/strange-behavior-using-html-readonly-readonly-vs-javascript-element-readon) – Nutshell Nov 11 '11 at 19:20