jk121960
jk121960

Reputation: 873

NetSuite SuiteScript Client Side drop down validation

I have a custom form where, in a subtab, I have a dropdown that I need to find out the selected value on the client side after the user selects to perform some validation. I created the script and tied it to the on change event of the dropdown. I cannot seem to find the code to get the selected value on the client side. I have found code to read the value on the server side from a submit event. I need this on the client side on change. I am going to use the ID to look up a record and check a value on that record and if applicable popup a warning to the user. Either SS1 or SS2 is good, whatever would be better I have both available. Any help with this would be great. thanks

Upvotes: 0

Views: 1241

Answers (2)

jk121960
jk121960

Reputation: 873

OK the nlapiGetFieldValue, did not do the trick, what did was the following

function ValidateField( type, field, linenum ) {
    if ( field === 'recordid' ) {
        var vendorid = nlapiGetCurrentLineItemValue(type,field,linenum);
        var vendorRecord = nlapiLoadRecord('vendor',vendorid);

    }

    return true;
}

thanks for your help

Upvotes: 0

michoel
michoel

Reputation: 3783

In a client script, you can use nlapiGetFieldValue() to retrieve the results.

function fieldchanged(type, name, linenum) {
    if(name == 'dropdownid') {
        var value = nlapiGetFieldValue('dropdownid');
        alert(value);
    }
}

Upvotes: 0

Related Questions