FormBuilder
The form builder is an easy way to create and handle forms. Each form need to be a class like this
import LangManager from "../utils/LangManager";
import Forms from "../Plasma/Forms/Forms";
import FormType from "../Plasma/Forms/FormType";
export default class LoginForm extends Forms {
constructor(formId, data) {
super(formId, data);
}
build() {
this.add("email", FormType.type.STRING, {
label: false,
required: true,
placeholder: LangManager.getLang().PSEUDO,
})
this.add("password", FormType.type.PASSWORD, {
label: false,
required: true,
placeholder: LangManager.getLang().PASSWORD,
})
this.add("remember", FormType.type.CHECKED, {
label: LangManager.getLang().REMEMBER_ME,
required: false,
mapped: false
})
}
}
They are located in src/forms
The class must extends Forms and implement method build()
Let's focus to one input :
this.add("email", FormType.type.STRING, {
label: false,
required: true,
placeholder: LangManager.getLang().PSEUDO,
})
When you create an input you must provide a name and a type. Here ne thame is "esmail" and the type is STRING (who mean input type text)
The third option (called labels) are not needed but can help you to edit your input see Labels
Last updated