You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current version is not able to link from object to form fields, when using a '.' in a field name as ASP.NET MVC does by default when having hierarchical data in a form (when using the EditorFor<> helpers for model properties).
$(data).setField("Name", "SomeNewValue"); <- works (in first level of hierarchy, so no '.'
$(data).setField("English_Name", "SomeNewValue"); <- works (uses the id)
$(data).setField("English.Name", "SomeNewValue"); <-does not work (should use the name)
I have also noticed this behavior. I am using Spring MVC and also need to have the model mapped using dot notation. I have been trying to figure out a fix for this but have been unsuccessful as of yet. Leaning toward implementing my own solution.
I was able to modify the setField function to fix this behavior. The block of code that handles updating the backing object would split the name on a '.' character. I think it has something to do with name-spacing for the event handler. If the code is modified to remove this, it works perfectly fine. This will, of course, break the initial design, but I for one will never need to code to behave how it was originally designed. Here is the code;
This
var parts = field.split('.');
parts[1] = parts[1] ? '.' + parts[1] : '';
var $this = $(target),
args = [ parts[0], value ];
$this.triggerHandler(eventNameSetField + parts[1] + '!', args);
if (value !== undefined) {
target[ field ] = value;
}
$this.triggerHandler(eventNameChangeField + parts[1] + '!', args);
The current version is not able to link from object to form fields, when using a '.' in a field name as ASP.NET MVC does by default when having hierarchical data in a form (when using the EditorFor<> helpers for model properties).
Thats the commit:
f2b13ff
The text was updated successfully, but these errors were encountered: