After a value is typed into an input field then the value from the page state rendered is ignored
See original GitHub issueIn my use case I have a page with a form and a list of Customers. The form has a customer name. When someone clicks on a customer in the list I populate the customer form like this from the state.
def formFieldCustomer(title: String, elId: ElementId, name: String, value: String) = {
'div('class /= "form-group",
'label('class /= "col-sm-3 control-label", title),
'div('class /= "col-sm-9",
'div('class /= "input-group",
'input(elId, 'name /= name, 'type /= "text", 'class /= "form-control", 'placeholder /= title, 'value /= value)
)
)
)
}
Now if the user clicks on a customer in the list, the value gets set in the input field from customer state and that’s good. If the user clicks on another customer, the value gets set, that’s good.
Now if the user types in the input field, then now clicks on a customer, the customer’s value does not get set anymore, the value that was typed in the input field remains, even if I click on any customer in the list. This is a problem.
Previously as a solution I was doing:
access.property[String](bankAccountNameField).set('value, item.accountName)
But this is no good for 50 fields, its too slow.
I should also add that if I inspect the HTML DOM with Chrome inspector debugger I can see the CORRECT value is set in the HTML DOM but the value that I inputted by typing appears to still be there.
Issue Analytics
- State:
- Created 6 years ago
- Comments:15 (15 by maintainers)
Top GitHub Comments
Hmm. This is looking strange. Korolev does not tracks style properties in a some special way. Possible it is a bug in the changes-inferring algorithm. The algorithm used in 0.3.0 has not have comprehensive tests so problems like this is possible. Try to shuffle attributes, it can help in such cases.
Currently I hard working under new template engine and changes-inferring algorithm (DSL will be compatible). https://github.com/fomkin/levsha It will be much faster (thousands of complex trees comparision per second), and will have very low memory-allocation rate. Also it has very strict property checks. I plan release at the end of May.
access.resetForm
should help.