Where as dialog.confirm/alert doesnt.
# suitescript
k
Where as dialog.confirm/alert doesnt.
w
Ext.MessageBox.confirm('ExtJS Confirm', 'Do you want to use ExtJS?', function (btn){ if (btn == 'Yes'){ return true; } else { return false; }
Should that allow me to save the document when the yes is clicked?
k
You dont even need to do that.
w
Hmm... I'm missing something then..
k
2 secs. I'll get you a sample
w
ok thakns
k
Ext.MessageBox.confirm('Saving Record.....', 'Do you wish to save this record?');
This should return true or false on it's own.
w
Copy code
/**
 * @NApiVersion 2.x
 * @NScriptType ClientScript
 * @NModuleScope SameAccount
 */
//# sourceURL=POTaxCodeFreightLine.js
define(['N/ui/dialog'],
/**
 * @param {dialog} dialog
 */
function(dialog) {
 
    /**
     * Validation function to be executed when record is saved.
     *
     * @param {Object} scriptContext
     * @param {Record} scriptContext.currentRecord - Current form record
     * @returns {boolean} Return true if record is valid
     *
     * @since 2015.2
     */
    function saveRecord(context) {
      	Ext.MessageBox.confirm('ExtJS Confirm', 'Do you want to use ExtJS?');
    };
    
    return {
        saveRecord: saveRecord
    };
    
});
k
return Ext.MessageBox.confirm('Saving Record.....', 'Do you wish to save this record?');
w
using the above it will not continue to save.
k
Copy code
/**
 * @NApiVersion 2.x
 * @NScriptType ClientScript
 * @NModuleScope SameAccount
 */
//# sourceURL=POTaxCodeFreightLine.js
define(['N/ui/dialog'],
/**
 * @param {dialog} dialog
 */
function(dialog) {
 
    /**
     * Validation function to be executed when record is saved.
     *
     * @param {Object} scriptContext
     * @param {Record} scriptContext.currentRecord - Current form record
     * @returns {boolean} Return true if record is valid
     *
     * @since 2015.2
     */
    function saveRecord(context) {
          return Ext.MessageBox.confirm('ExtJS Confirm', 'Do you want to use ExtJS?');
    };
    
    return {
        saveRecord: saveRecord
    };
    
});
Try this
w
message has been deleted
Didn't even get a chance to click OK.
k
Hmmmmmm Gotta be honest i have only used the alert version on saveRecord. but am using it within an if statement.,
might just be worth sticking with the standard JS to be honest.
w
Ok.. thanks... I'll let you know if I figure it out.. and maybe the IF statement is the key part.
j
Nothing besides the built in window.prompt, window.confirm or window.alert will halt the javascript main thread until you click the pop up
w
I actually just finished reading that. Thanks