All Projects → adib2149 → Formmaster

adib2149 / Formmaster

Licence: apache-2.0
Easily build big and bigger forms with minimal effort

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Formmaster

Formvuelate
Dynamic schema-based form rendering for VueJS
Stars: ✭ 262 (+72.37%)
Mutual labels:  forms, form-builder
Forms Angular
Probably the most opinionated framework in the world
Stars: ✭ 412 (+171.05%)
Mutual labels:  forms, form-builder
Tellform
✏️ Free Opensource Alternative to TypeForm or Google Forms ⛺
Stars: ✭ 2,941 (+1834.87%)
Mutual labels:  forms, form-builder
Form Manager
PHP library to create and validate html forms
Stars: ✭ 124 (-18.42%)
Mutual labels:  forms, form-builder
Rsformview
A Cocoapods library designed to easily create forms with multiple data entry fields
Stars: ✭ 84 (-44.74%)
Mutual labels:  forms, form-builder
grav-plugin-form
Grav Form Plugin
Stars: ✭ 48 (-68.42%)
Mutual labels:  forms, form-builder
React Hook Form
📋 React Hooks for form state management and validation (Web + React Native)
Stars: ✭ 24,831 (+16236.18%)
Mutual labels:  forms, form-builder
formio
Formio, form definition and binding library for Java platform
Stars: ✭ 24 (-84.21%)
Mutual labels:  forms, form-builder
Formium
The headless form builder for the modern web.
Stars: ✭ 78 (-48.68%)
Mutual labels:  forms, form-builder
Usetheform
React library for composing declarative forms, manage their state, handling their validation and much more.
Stars: ✭ 40 (-73.68%)
Mutual labels:  forms, form-builder
yii2-forms
Forms CRUD - formbuilder, generator code
Stars: ✭ 32 (-78.95%)
Mutual labels:  forms, form-builder
Form For
ReactJS forms made easy
Stars: ✭ 118 (-22.37%)
Mutual labels:  forms, form-builder
react-emotion-multi-step-form
React multi-step form library with Emotion styling
Stars: ✭ 25 (-83.55%)
Mutual labels:  forms, form-builder
React Reactive Form
Angular like reactive forms in React.
Stars: ✭ 259 (+70.39%)
Mutual labels:  forms, form-builder
django-formidable
On the way to glory! again!
Stars: ✭ 19 (-87.5%)
Mutual labels:  forms, form-builder
Django Fobi
Form generator/builder application for Django done right: customisable, modular, user- and developer- friendly.
Stars: ✭ 360 (+136.84%)
Mutual labels:  forms, form-builder
react-cool-form
😎 📋 React hooks for forms state and validation, less code more performant.
Stars: ✭ 246 (+61.84%)
Mutual labels:  forms, form-builder
ember-formly
JavaScript powered forms for Ember
Stars: ✭ 24 (-84.21%)
Mutual labels:  forms, form-builder
Django Rest Formly
Generate angular-formly form configuration object for Django REST endpoints.
Stars: ✭ 7 (-95.39%)
Mutual labels:  forms, form-builder
Uniforms
A React library for building forms from any schema.
Stars: ✭ 1,368 (+800%)
Mutual labels:  forms, form-builder

Form-Master

Download

Easily build big and bigger forms with minimal effort

This library aids in building bigger forms on-the-fly. Forms with large number of elements can easily be added programmatically within a few minutes.

Features

  • Easily build big and bigger forms with minimal effort
  • Fast color change as needed

Installation

Add this in your app's build.gradle file:

compile 'me.riddhimanadib.form-master:form-master:1.1.0'

How to use

  1. Add a Recyclerview anywhere in the layout where you want your list to be shown (If confused, look at the examples in this repo).
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <android.support.v7.widget.RecyclerView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:id="@+id/recyclerView"
        android:descendantFocusability="beforeDescendants" />

</LinearLayout>
  1. Add the Form Elements programmatically in your activity
// initialize variables
mRecyclerView = (RecyclerView) findViewById(R.id.recyclerView);
mFormBuilder = new FormBuildHelper(this, mRecyclerView);

// declare form elements
FormHeader header = FormHeader.createInstance("Personal Info");
FormElementTextEmail element = FormElementTextEmail.createInstance().setTitle("Email").setHint("Enter Email");
        
// add them in a list
List<FormObject> formItems = new ArrayList<>();
formItems.add(header);
formItems.add(element);

// build and display the form
mFormBuilder.addFormElements(formItems);
mFormBuilder.refreshView();
  1. Now build and run!!

Changelog

####v1.1.0

  1. New FormElement type: Switch.
  2. New way to define the form elements.
  3. Can set Titles in alert dialogs for Date and Time type form element.
  4. Can set Positive and negative texts for Date, Time and Switch type form elements.
  5. Can set Date and Time formats (if unset, default format will be used).

Reference

Item Definition

Header:

FormHeader header = FormHeader.createInstance("Personal Info");

Regular Elements:

General object format

<Class> element = <Class>.createInstance()
    .setTag(101123151) // optional tag to uniquely identify the elemnt for later use
    .setType(FormElement.TYPE_PICKER_MULTI_CHECKBOX) // setting input type
    .setTitle("Pick your favourite fruit") // setting title
    .setValue("Banana") // setting value of the field, if any
    .setOptions(fruits) // setting pickable options, if any
    .setHint("e.g. banana, guava etc") // setting hints, if any
    .setRequired(false); // marking if the form element is required to be filled to make the form valid, include if needed

Samples:

// email input
FormElementTextEmail element = FormElementTextEmail.createInstance().setTitle("Email").setHint("Enter Email");

// phone number input
FormElementTextPhone element = FormElementTextPhone.createInstance().setTitle("Phone").setValue("+8801712345678");

// single line text input
FormElementTextSingleLine element = FormElementTextSingleLine.createInstance().setTitle("Location").setValue("Dhaka");

// multi line text input (default 4)
FormElementTextMultiLine element = FormElementTextMultiLine.createInstance().setTitle("Address");

// number element input
FormElementTextNumber element = FormElementTextNumber.createInstance().setTitle("Zip Code").setValue("1000");

// date picker input
FormElementPickerDate element = FormElementPickerDate.createInstance().setTitle("Date").setDateFormat("MMM dd, yyyy");

// time picker input
FormElementPickerTime element = FormElementPickerTime.createInstance().setTitle("Time").setTimeFormat("KK hh");

// password input
FormElementTextPassword element = FormElementTextPassword.createInstance().setTitle("Password").setValue("abcd1234");

// switch input
FormElementSwitch element = FormElementSwitch.createInstance().setTitle("Frozen?").setSwitchTexts("Yes", "No");

// single item picker input
List<String> fruits = new ArrayList<>();
fruits.add("Banana");
fruits.add("Orange");
fruits.add("Mango");
fruits.add("Guava");
FormElementPickerSingle element = FormElementPickerSingle.createInstance().setTitle("Single Item").setOptions(fruits).setPickerTitle("Pick any item");

// multiple items picker input
List<String> fruits = new ArrayList<>();
fruits.add("Banana");
fruits.add("Orange");
fruits.add("Mango");
fruits.add("Guava");
FormElementPickerMulti element = FormElementPickerMulti.createInstance().setTitle("Multi Items").setOptions(fruits).setPickerTitle("Pick one or more").setNegativeText("reset");

Set form element value change listener to get changed value instantly

While creating new instance of FormBuildHelper, add a listener in the constructor

Have a look at the example code for details

FormBuildHelper mFormBuilder = new FormBuildHelper(this, mRecyclerView, new OnFormElementValueChangedListener() {
    @Override
    public void onValueChanged(FormElement formElement) {
        // do anything here with formElement.getValue()
    }
}
);

Set unique tags for form elements (for later value retrieval)

Just add a unique tag for the element

FormElement element = FormElement.createInstance()
    .setTag(2149) // unique tag number to identify this element
    .setType(FormElement.TYPE_PICKER_MULTI_CHECKBOX)
    .setTitle("Pick your favourite fruit");

Get value for unique form elements

Use the unique tag assigned earlier to retrieve value (See examples in this repo)

FormElement targetElement = mFormBuilder.getFormElement(2149);
String targetValue = targetElement.getValue();

Check if form is valid

Use this method if you need to check whether the required elements of the form is completed

mFormBuilder.isValidForm(); // returns boolean whether the form is valid or not

Form accent color change

If you want to change the colors, just override the colors in your colors.xml file:

<color name="colorFormMasterHeaderBackground">#DDDDDD</color>
<color name="colorFormMasterHeaderText">#000000</color>
<color name="colorFormMasterElementBackground">#FFFFFF</color>
<color name="colorFormMasterElementTextTitle">#222222</color>
<color name="colorFormMasterElementTextValue">#000000</color>
<color name="colorFormMasterDivider">#DDDDDD</color>

Form UI change

If you want to change how the forms look, just override the layout xml named form_element.xml and/or form_element_header.xml in your project.

Just make sure to keep the ID name same as it is in the library for the components.

android:id="@+id/formElementTitle"
android:id="@+id/formElementValue"

Contributing

Send Pull Requests and you're in!! Alternatively, you can start adding issues here in this repo!

License

This Library is released under the Apache License, Version 2.0.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].