Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the forms file, add placeholder support #1330

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions dev/jquery.jtable.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
* CONSTRUCTOR AND INITIALIZATION METHODS *
*************************************************************************/

/* Contructor.
/* Constructor.
*************************************************************************/
_create: function () {

Expand Down Expand Up @@ -138,8 +138,11 @@
if (props.inputClass == undefined) {
props.inputClass = '';
}
if (props.placeholder == undefined) {
props.placeholder = '';
}

//Convert dependsOn to array if it's a comma seperated lists
//Convert dependsOn to array if it's a comma separated lists
if (props.dependsOn && $.type(props.dependsOn) === 'string') {
var dependsOnArray = props.dependsOn.split(',');
props.dependsOn = [];
Expand Down
16 changes: 8 additions & 8 deletions dev/jquery.jtable.forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*************************************************************************/

/* Submits a form asynchronously using AJAX.
* This method is needed, since form submitting logic can be overrided
* This method is needed, since form submitting logic can be overridden
* by extensions.
*************************************************************************/
_submitFormUsingAjax: function (url, formData, success, error) {
Expand Down Expand Up @@ -126,10 +126,10 @@
.append($textArea);
},

/* Creates a standart textbox for a field.
/* Creates a standard text input for a field.
*************************************************************************/
_createTextInputForField: function (field, fieldName, value) {
var $input = $('<input class="' + field.inputClass + '" id="Edit-' + fieldName + '" type="text" name="' + fieldName + '"></input>');
var $input = $('<input class="' + field.inputClass + '" placeholder="' + field.placeholder + '" id="Edit-' + fieldName + '" type="text" name="' + fieldName + '"></input>');
if (value != undefined) {
$input.val(value);
}
Expand All @@ -142,7 +142,7 @@
/* Creates a password input for a field.
*************************************************************************/
_createPasswordInputForField: function (field, fieldName, value) {
var $input = $('<input class="' + field.inputClass + '" id="Edit-' + fieldName + '" type="password" name="' + fieldName + '"></input>');
var $input = $('<input class="' + field.inputClass + '" placeholder="' + field.placeholder + '" id="Edit-' + fieldName + '" type="password" name="' + fieldName + '"></input>');
if (value != undefined) {
$input.val(value);
}
Expand All @@ -152,7 +152,7 @@
.append($input);
},

/* Creates a checkboxfor a field.
/* Creates a checkbox for a field.
*************************************************************************/
_createCheckboxForField: function (field, fieldName, value) {
var self = this;
Expand All @@ -179,7 +179,7 @@

//Check the checkbox if it's value is checked-value
if (self._getIsCheckBoxSelectedForFieldByValue(fieldName, value)) {
$checkBox.attr('checked', 'checked');
$checkBox.prop('checked', true);
}

//This method sets checkbox's value and text according to state of the checkbox
Expand All @@ -200,9 +200,9 @@
.addClass('jtable-option-text-clickable')
.click(function () {
if ($checkBox.is(':checked')) {
$checkBox.attr('checked', false);
$checkBox.prop('checked', false);
} else {
$checkBox.attr('checked', true);
$checkBox.prop('checked', true);
}

refreshCheckBoxValueAndText();
Expand Down
23 changes: 13 additions & 10 deletions lib/jquery.jtable.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ THE SOFTWARE.
* CONSTRUCTOR AND INITIALIZATION METHODS *
*************************************************************************/

/* Contructor.
/* Constructor.
*************************************************************************/
_create: function () {

Expand Down Expand Up @@ -167,8 +167,11 @@ THE SOFTWARE.
if (props.inputClass == undefined) {
props.inputClass = '';
}
if (props.placeholder == undefined) {
props.placeholder = '';
}

//Convert dependsOn to array if it's a comma seperated lists
//Convert dependsOn to array if it's a comma separated lists
if (props.dependsOn && $.type(props.dependsOn) === 'string') {
var dependsOnArray = props.dependsOn.split(',');
props.dependsOn = [];
Expand Down Expand Up @@ -1489,7 +1492,7 @@ THE SOFTWARE.
*************************************************************************/

/* Submits a form asynchronously using AJAX.
* This method is needed, since form submitting logic can be overrided
* This method is needed, since form submitting logic can be overridden
* by extensions.
*************************************************************************/
_submitFormUsingAjax: function (url, formData, success, error) {
Expand Down Expand Up @@ -1605,10 +1608,10 @@ THE SOFTWARE.
.append($textArea);
},

/* Creates a standart textbox for a field.
/* Creates a standard text input for a field.
*************************************************************************/
_createTextInputForField: function (field, fieldName, value) {
var $input = $('<input class="' + field.inputClass + '" id="Edit-' + fieldName + '" type="text" name="' + fieldName + '"></input>');
var $input = $('<input class="' + field.inputClass + '" placeholder="' + field.placeholder + '" id="Edit-' + fieldName + '" type="text" name="' + fieldName + '"></input>');
if (value != undefined) {
$input.val(value);
}
Expand All @@ -1621,7 +1624,7 @@ THE SOFTWARE.
/* Creates a password input for a field.
*************************************************************************/
_createPasswordInputForField: function (field, fieldName, value) {
var $input = $('<input class="' + field.inputClass + '" id="Edit-' + fieldName + '" type="password" name="' + fieldName + '"></input>');
var $input = $('<input class="' + field.inputClass + '" placeholder="' + field.placeholder + '" id="Edit-' + fieldName + '" type="password" name="' + fieldName + '"></input>');
if (value != undefined) {
$input.val(value);
}
Expand All @@ -1631,7 +1634,7 @@ THE SOFTWARE.
.append($input);
},

/* Creates a checkboxfor a field.
/* Creates a checkbox for a field.
*************************************************************************/
_createCheckboxForField: function (field, fieldName, value) {
var self = this;
Expand All @@ -1658,7 +1661,7 @@ THE SOFTWARE.

//Check the checkbox if it's value is checked-value
if (self._getIsCheckBoxSelectedForFieldByValue(fieldName, value)) {
$checkBox.attr('checked', 'checked');
$checkBox.prop('checked', true);
}

//This method sets checkbox's value and text according to state of the checkbox
Expand All @@ -1679,9 +1682,9 @@ THE SOFTWARE.
.addClass('jtable-option-text-clickable')
.click(function () {
if ($checkBox.is(':checked')) {
$checkBox.attr('checked', false);
$checkBox.prop('checked', false);
} else {
$checkBox.attr('checked', true);
$checkBox.prop('checked', true);
}

refreshCheckBoxValueAndText();
Expand Down