javascript - Alertify Prompt - Allow user to input values and submit form -
using alertify - version 0.3.11
, able fetch user input details , able show in prompt dialogue. have multiple values viz. user input, dropdown values, date selection, etc
var totalresources = jquery('#grid').jqgrid('getgridparam', 'selarrrow'); //set custom button title form submit alertify.set({ labels: { ok : "submit data", cancel : "cancel" } }); //fetch user input comment alertify.prompt("please enter note/remarks form :<br/>total resource(s): <strong>"+totalresources.length+"</strong>", function (e,value) { if (e) { alertify.success("data has been submitted"); //encodes special characters remarks var sow = encodeuricomponent(value); $.post(site_url+"somecontroller/someaction",$("#frm_submit").serialize()+ "&resource_ids="+resource_ids+"&sow="+sow, function( data ) { }); }else{ alertify.error("your data not submitted"); } });
similar shown in below image
how built modal form using alertify user see pre-fethced details , can input details , submit ?
they have added form feature in alertify. have @ this
from website code under:-
<!-- form viewed dialog--> <form id="loginform"> <fieldset> <label> username </label> <input type="text" value="mohammad"/> <label> password </label> <input type="password" value="password"/> <input type="submit" value="login"/> </fieldset> </form>
and js code:-
alertify.genericdialog || alertify.dialog('genericdialog',function(){ return { main:function(content){ this.setcontent(content); }, setup:function(){ return { focus:{ element:function(){ return this.elements.body.queryselector(this.get('selector')); }, select:true }, options:{ basic:true, maximizable:false, resizable:false, padding:false } }; }, settings:{ selector:undefined } }; }); //force focusing password box alertify.genericdialog ($('#loginform')[0]).set('selector', 'input[type="password"]');
Comments
Post a Comment