-
-
Save ikennaokpala/900759 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.bowlerframework.view.squery.component.ValidationFeedbackPanel._ | |
import org.bowlerframework.view.squery.Component | |
import org.bowlerframework.RequestScope | |
class NewWidgetForm extends Component{ | |
val request = RequestScope.request | |
$("#errorPanel").contents = showErrorMessages | |
request.getSession.getValidatedModel match{ | |
case None => bindModel(Widget(0, null, null, null)) | |
case Some(seq) => bindModel(seq.head) | |
} | |
def bindModel(widget: Widget){ | |
$("form input[name='widget.id']").attribute("value", valueOrEmpty(widget.id)) | |
$("form input[name='widget.name']").attribute("value", valueOrEmpty(widget.name)) | |
$("form input[name='widget.yearMade']").attribute("value", valueOrEmpty(widget.yearMade)) | |
$("form input[name='widget.description']").attribute("value", valueOrEmpty(widget.description)) | |
} | |
implicit def Any2Widget(e: Any): Widget = e.asInstanceOf[Widget] // Converting Type Any to Widget i think !! wfaler don't shot me lol | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
may be something like this.. i assume it's of type Any & could be implicitly converted to Widget on the fly. my 2Cents..