Coder Social home page Coder Social logo

formbuilder's Introduction

๐Ÿ›  - Featured Repositories

๐ŸŽ - iOS

StorageDone-iOS

Cobb

DPTimePicker

DPRadialMenu

๐Ÿค– - Android

StorageDone-Android

Spike

DeclarativeRecycler

๐Ÿ–ฅ - Backend

KDone

Projects

Italy Nowadays


iOS & Android
News from the world, updated, fast, safe

Stormy Europe


iOS
Stay informed about severe weather events in Europe

Odeum


iOS
Generate your podcasts with AI

formbuilder's People

Contributors

dariopellegrini avatar shehabattia96 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

formbuilder's Issues

Spinner in forms

This is an excellent library, but spinners are necessary, when you think we could enjoy this feature, thanks

Errors do not appear for some FormElement types

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.

Problems with Single Selection

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();
    }

Use in Fragments and tabs

Good afternoon.
There is some example of this excellent library to use it with fragments and tabs. thank you

Required validation of SELECTION and MULTIPLE_SELECTION fails

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());
        }
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.