LiftScreen adds id attribute to all elements in toForm html
LiftScreen currently adds an id attribute to all elements in a field's toForm html. This makes it difficult to use javascript to select the element and violates the uniqueness of ids on a page.
Also, the code that checks for the existence of an id attribute never gets called because uniqueFieldId takes precedence and the xml selector fails as well.
All of this is in ScreenWizardRendered.bindFieldLine
I'm not sure what the solution for the first part is, but the second part could be fixed with changing:
val curId = f.field.uniqueFieldId or theForm.flatMap(x => (x \ "@id").headOption.map(_.text)) openOr Helpers.nextFuncName
to:
val curId = theForm.flatMap(x => (x \\ "@id").headOption.map(_.text)) or f.field.uniqueFieldId openOr Helpers.nextFuncName
Mailing list discussion:
https://groups.google.com/d/topic/liftweb/bfHnuH_AB2k/discussion
Also, the code that checks for the existence of an id attribute never gets called because uniqueFieldId takes precedence and the xml selector fails as well.
All of this is in ScreenWizardRendered.bindFieldLine
I'm not sure what the solution for the first part is, but the second part could be fixed with changing:
val curId = f.field.uniqueFieldId or theForm.flatMap(x => (x \ "@id").headOption.map(_.text)) openOr Helpers.nextFuncName
to:
val curId = theForm.flatMap(x => (x \\ "@id").headOption.map(_.text)) or f.field.uniqueFieldId openOr Helpers.nextFuncName
Mailing list discussion:
https://groups.google.com/d/topic/liftweb/bfHnuH_AB2k/discussion
Leave a comment