html - How to generate 'required' Attribute in GWT using UIBinder? -


expected html

<input class="sth" type="input" required/> 

how generate using uibinder in gwt? using following , not generating required attribute

<g:textbox ui:field="username"/> 

you cannot in uibinder standard textbox widget. if one-off situation, set in code. if use often, create own widget extending textbox , adding:

public void setrequired(boolean isrequired) {     if (isrequired) {         getelement().setattribute("required", "required");     } } 

then can use in uibinder:

<w:mytextbox ui:field="username" required="true"/> 

where w links widgets folder.


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -