@osimatic/helpers-js 1.0.74 → 1.0.77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/form_helper.js +17 -0
  2. package/package.json +1 -1
package/form_helper.js CHANGED
@@ -22,6 +22,12 @@ class FormHelper {
22
22
  return form.find('select[name="'+selectName+'"] option:not([disabled])').length;
23
23
  }
24
24
 
25
+ static reset(form) {
26
+ form.find('[name]').each((idx, el) => $(el).val(''));
27
+ FormHelper.hideFormErrors(form);
28
+ return form;
29
+ }
30
+
25
31
  static getFormData(form) {
26
32
  // var formElement = document.getElementById("myFormElement");
27
33
  return new FormData(form[0]);
@@ -99,6 +105,17 @@ class FormHelper {
99
105
  }).get().filter(word => word.length > 0);
100
106
  }
101
107
 
108
+ static getInputValue(input) {
109
+ if (typeof input == 'undefined') {
110
+ return null;
111
+ }
112
+ let value = $(input).val();
113
+ if (value === null || value === '') {
114
+ return null;
115
+ }
116
+ return value;
117
+ }
118
+
102
119
  static getLinesOfTextarea(textarea) {
103
120
  return textarea.val().replace(/(\r\n|\n|\r)/g, "\n").split("\n").filter(word => word.length > 0);
104
121
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osimatic/helpers-js",
3
- "version": "1.0.74",
3
+ "version": "1.0.77",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"