alertify.js
JavaScript Alert/Notification System
alertify.js - browser dialogs never looked so good
The following code produces a prompt with a single input box, however i need to have two input boxes . Is this achievable ?
alertify.prompt("Please enter Values","Default Text").set('onok', function(closeevent, value) {
if (value == "" || value == " " )
{
alertify.error("No value entered");
return;
}
else
{
updateItem(selectedItem,value);
}
}).set('title',"Update Values");
Source: (StackOverflow)
As a disclaimer, I'm new to nodejs and express framework in general so please bear with me while I'm still trying to learn.
I'm using alertifyjs library to show notifications for various alerts to a user. Now, the problem is that the notifications are showing for everyone who is on the site. I get why this is happening and it makes sense. How do I go about making it so a specific alert only shows for the person that triggered it? What exactly do I use to make this happen? Cookies?
Thank you for your help and let me know if you need any more information.
Here's a code example...
//client code
socket.on('word length', function(data) {
alertify.error('Check word length!');
});
//server code
if (word.length > 50 || word.length <= 1) { // check word length:
io.sockets.emit('word length', word);
}
Source: (StackOverflow)
AlertifyJS has a place to put auxiliary buttons.
I would like for two things to happen when my auxiliary button is clicked
- The dialog should not close
- Some function should be run
How do I do these two things?
I can get the notification to show up by passing it as the third parameter, but the dialog disappears. Also, this wouldn't work if I had multiple auxiliary buttons and different functions for each.
Below is my javascript, and here is a JSFiddle.
// Run this function when the auxiliary button is clicked
// And do not close the dialog
var helpInfo = function () {
alertify.notify("help help help");
};
var custom = function () {
if (!alertify.helper) {
alertify.dialog('helper', function factory() {
return {
setup: function () {
return {
buttons: [{
text: 'Help',
scope: 'auxiliary'
}],
options: {
modal: false
}
};
}
};
}, false, 'alert');
}
alertify.helper('Do you need help?', "hello world", helpInfo);
};
custom();
Source: (StackOverflow)
$("#btn_submit").click(function(){
alertify.prompt("Please enter note/remarks for this Form:", function (e, value) {
$("#alertify-ok").val('Submit Form'); //change button text
if (e) {
alertify.success("Form has been submitted");
} else {
alertify.error("Your form is not submitted");
}
});
HTML for alertify prompt dialog
<button id="alertify-ok" class="alertify-button alertify-button-ok" type="submit">
OK
</button>
The prompt appears when user clicks on submit button. Tried changing button text using below but its not working
$("#alertify-ok").val('Submit Form'); //change button text
Fiddle- where I need to change the default OK
button text to something else
How could I change the button text to Submit Form
instead of default OK
?
Source: (StackOverflow)
i'm using angular.js and alertify.js to list user in here:
Plunkr
the problem is : after I click the delete menu, a confirmation window appears, then after OK button clicked, the deleted row still there until you click Delete button again.
It seems, Angular doesn't know when to update itself. Anyone know How to 'reload' this user table properly in Angular?
here's my html file:
<table class="table">
<tbody>
<tr ng-repeat="user in users">
<td>{{ user.name }}</td>
<td>{{ user.age }}</td>
<td>
<button class="btn btn-danger" ng-click="removeUser($index)">
Delete
</button>
</td>
</tr>
</tbody>
</table>
here's my function app.js :
var app = angular.module('demo', []);
app.controller('DemoCtrl', function($scope, $http) {
$scope.users = [
{name: "Jack", age: 10},
{name: "Bart",age: 20},
{name: "Griffin",age: 40}]
$scope.removeUser = function(index) {
alertify.confirm("You Sure ?").set('onok', function() {
$scope.users.splice(index, 1)
})
}
});
Source: (StackOverflow)
I was just writing some code and I met a problem like this:
alertify.dialog("confirm").set(
{
'labels':
{
ok: 'Personal',
cancel: 'Share'
},
'message': 'Select target:',
'onok': function()
{
alertify.confirm($("#dir_select_user").get(0), function()
{
var i = $("#dir_select_user .dir_selector").val();
t.find(".move_des").val(i);
t.find(".move_verify").val("1");
t.submit();
}).set('labels',
{
ok: alertify.defaults.glossary.ok,
cancel: alertify.defaults.glossary.cancel
});
},
'oncancel': function()
{
alertify.confirm($("#dir_select_share").get(0), function()
{
var i = $("#dir_select_share .dir_selector").val();
t.find(".move_des").val(i);
t.find(".move_verify").val("1");
t.submit();
}).set('labels',
{
ok: alertify.defaults.glossary.ok,
cancel: alertify.defaults.glossary.cancel
});
}
}) }).show();
I use the alertifyjs
library from http://alertifyjs.com (not from http://fabien-d.github.io/alertify.js/).
If you try this code, you'll find that 'onok' and 'oncancel' dialogs quickly disappear after choosing personal
or share
.
What's the problem here? How can I solve it?
Source: (StackOverflow)