I am using JSLink to update the input text field on the NewForm. I want the same input textbox html and am only adding some styling to it (in this case background-color==lime).
So I start by copying the HTML markup from the original form as shown here.
<span dir='none'>
<input
title="Engineering Project
Name" class="ms-long ms-spellcheck-true"
id="Enginering_x0020_Project_x0020_N_d007ab6e-25bc-4330-abd5-4f9f21c2182f_$TextField"
type="text"
maxlength="255"
value="">
</input>
</span>
After my JSLink is applied the code transforms to the same markup only my style attribute is now applied.
<span dir="none">
<input
title="Engineering Project Name"
class="ms-long ms-spellcheck-true"
id="Enginering_x0020_Project_x0020_N_d007ab6e-25bc-4330-abd5-4f9f21c2182f_$TextField"
style="background-color: lime;"
type="text"
maxlength="255"
value="">
</span>
When I enter data into the Engineering Project Name field and save the form and then edit the item I can see my data was not saved! :(
Can anyone tell me what may be wrong? I am loosing the remaining hairs on my head. Thanks for reading.
Here is my jslink file.
(function () {
var EngineeringProjectNameFieldCtx = {};
EngineeringProjectNameFieldCtx.Templates = {};
EngineeringProjectNameFieldCtx.Templates.Fields = {
"Enginering_x0020_Project_x0020_N": {
"DisplayForm":null,
"View": null,
"NewForm": ModifyNewFormTemplate,
"EditForm": null
}
};
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(EngineeringProjectNameFieldCtx);
var _Field = SPClientTemplates.Utility.GetFormContextForCurrentField(ctx);
var _FieldId = _Field.fieldSchema.Id;
var _FieldName = _Field.fieldName;
var newField = "<span dir='none'><input style='background-color:lime' title='Engineering Project Name' class='ms-long ms-spellcheck-true' id='Enginering_x0020_Project_x0020_N_" + _FieldId + "_$TextField' title='" + _FieldName + "' type='text' maxlength='255' value=''></span>";
return newField;
}
})();
Additional Details:
The Fiddler trace shows that my updated field is not even being submitted to the _vti_bin/client.svc/ProcessQuery URL.