Fields set by jQuery are not submitted

Fields set by jQuery are not submitted

I have a simple form with input fields and a submit button:

<form id="attrform" name="attrform" method="post" action="/office/faces/editattributes.xhtml">
  <input id="attrform:atid" type="text" name="attrform:atid" readonly="readonly" />
  <input id="attrform:atname" type="text" name="attrform:atname" value="title" />
  <input type="submit" name="attrform:j_idt16" value="Save" />
</form>


(Simplified - I didn't want to dump the whole source here)

Below the form I have a table of data and I have a piece of jquery code that copies any row I click on into the form - something like " $('#attrform\\:atid').val($(this).children().eq(0).text()); "; this works fine. What doesn't work is, if I click on a row, which sets the fields in the form, and then click the Submit button, the field data are ignored, but if I change the fields, they get sent - I can see this when I capture the http packets in wireshark.

Clearly I need to do more than just setting the field values with ...val() - but what? Is there a flag that needs to be set or something?