mirror of
https://github.com/dzeiocom/FormManager.git
synced 2025-04-23 03:12:14 +00:00
Added a Mode Switcher
This commit is contained in:
parent
bb85279818
commit
36c41446ea
@ -322,6 +322,26 @@ export default class FormManager {
|
|||||||
ajax.send()
|
ajax.send()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public setMode(mode: FMMode) {
|
||||||
|
if (mode == FMMode.ViewMode) {
|
||||||
|
for (const name in this.inputs) {
|
||||||
|
if (this.inputs.hasOwnProperty(name)) {
|
||||||
|
const input = this.inputs[name];
|
||||||
|
input.element.setAttribute("disabled", "")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (mode == FMMode.EditMode) {
|
||||||
|
for (const name in this.inputs) {
|
||||||
|
if (this.inputs.hasOwnProperty(name)) {
|
||||||
|
const input = this.inputs[name];
|
||||||
|
input.element.removeAttribute("disabled")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear the fields in the form
|
* Clear the fields in the form
|
||||||
*
|
*
|
||||||
@ -339,6 +359,10 @@ export default class FormManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum FMMode {
|
||||||
|
EditMode,
|
||||||
|
ViewMode
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: FMFileInput
|
* TODO: FMFileInput
|
||||||
|
Loading…
x
Reference in New Issue
Block a user