classafFormBean::SkinCtx
sys::Obj afFormBean::SkinCtx
Passed to InputSkins to provide all the information they need to render a form field.
- bean
Obj? bean { internal set }The bean instance being rendered.
- beanInvalid
Bool beanInvalid()Returns
trueif the bean is invalid; that is, if any field is in error.Convenience for formBean.hasErrors().
- errMsg
Str? errMsgConvenience for FormField.errMsg.
The error message associated with this field.
Setting this to a non-null value invalidate the form field.
- field
const Field fieldThe corresponding bean field.
- fieldInvalid
Bool fieldInvalidConvenience for FormField.invalid.
Returns
trueif the form field is invalid. Note that just because the field is invalid, it does not mean it has an error message.Setting this to
falsealso clears anyerrMsg.- fieldValue
Obj? fieldValue()Returns the field value.
- formBean
FormBean formBean { internal set }The containing
FormBeaninstance.- formField
FormField formField { internal set }The
FormFieldbeing rendered.- id
Str id()Convenience for
field.nameplus any unique ID suffix defined by theFormBean.- label
Str label()Returns the preferred display label associated with the field.
- msg
Str? msg(Str key, Obj? arg1 := null, Obj? arg2 := null, Obj? arg3 := null)Convenience for FormField.msg.
Returns a message for the given field. Messages are looked up in the following order:
<bean>.<field>.<key><field>.<key><key>
And the following substitutions are made:
${label} -> formField.label${value} -> formField.formValue${arg1} -> arg1.toStr${arg2} -> arg2.toStr${arg3} -> arg3.toStr
The form value is substituted for
${value}because it is intended for use by validation msgs.Returns
nullif a msg could not be found.- name
Str name()Convenience for
field.nameand used as the form name. Also safe for use as a CSS class name.- renderAttributes
Str renderAttributes([Str:Str]? extraAttributes := null)Returns a rendered string of common attributes to be placed in the
<input>HTML tag. This includesid,nameand any validation attributes defined on theHtmlInputfacet.Note the string does not contain the
typeorvalueattributes as these are dependent on the input type.The given
extraAttributesare merged in, with any values of the same name being separated with a space. This allows you to pass in extra css class names.attrs := skinCtx.renderAttributes(["data-foo" : "bar", "css" : "funkStyle"])
Note that empty string values are rendered as HTML5 empty attributes. e.g.
["disabled":""]would be rendered as justdisabled.- toClient
Convenience for formField.toClient().
Converts the given value to a string using the preferred
ValueEncoder.- value
Str value()Returns the preferred string value to be rendered in the
<input>.