iOS & Android
News from the world, updated, fast, safe
iOS
Stay informed about severe weather events in Europe
iOS
Generate your podcasts with AI
An Android library to build form and form validations easily.
how to implement custom style in form element? its might be really useful to had ๐
This is an excellent library, but spinners are necessary, when you think we could enjoy this feature, thanks
If the FormElement
type is set to any of the following, then the error message does not show if validation fails:
SELECTION
MULTIPLE_SELECTION
DATE
TIME
I believe this is because the FormBuilder.buildElement()
method adds the wrong EditText
object to the viewMap
:
textInputLayout = new TextInputLayout(context);
final EditText selectionEditText = new EditText(context);
....
// Wrong object added here!
viewMap.put(formElement.getTagOrToString(), editText);
addViewToView(textInputLayout, selectionEditText);
The selectionEditText
object is added to the screen, but the editText
object is added to the map. So when FormBuilder.validate()
is called then the error is added to editText
instead of selectionEditText
.
When using single selection mode, if you try to change the value by clicking on the edittext it simply adds the new selection to the EditText making it act like Multiple Selection
We can fix it by replacing the pickDialog() Method with the following
private void pickDialog(final EditText selectedEditText, final FormElement selectedFormElement) {
this.selectedEditText = selectedEditText;
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle("");
builder.setSingleChoiceItems(selectedFormElement.getOptions().toArray(new CharSequence[selectedFormElement.getOptions().size()]), selectedFormElement.getCheckedValue(), null);
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
int selectedPosition = ((AlertDialog) DialogInterface).getListView().getCheckedItemPosition();
String selectedElement = (selectedFormElement.getOptions().get(selectedPosition));
selectedFormElement.setValue(selectedElement);
selectedEditText.setText(selectedElement);
}
});
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
}
});
builder.show();
}
Good afternoon.
There is some example of this excellent library to use it with fragments and tabs. thank you
If you set a FormElement
of type SELECTION
or MULTIPLE_SELECTION
as required
, it will always fail validation because FormBuilder.validate()
checks the value
field on the FormElement
but not the optionsSelected
field that is set for these types.
if (element.getRequired()) {
// Should check optionsSelected if element.type == SELECTION or MULTIPLE_SELECTION
if (element.getValue() == null || element.getValue().length() == 0) {
isValid = false;
if (view instanceof EditText) {
((EditText) view).setError(element.getErrorMessageOrDefault());
}
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.