Suggest value
Suggest value
Hi,
I'm trying to suggest a value when a user inline edits a field. The function I have at the moment is this:
editor.field( 'finalOrder' ).input().on( 'focus', function (e, d) {
if ( ! d || ! d.editor ) {
caseQty = editor.field( 'caseQty' ).val() ;
defaultInputValue = editor.field( 'finalOrder' ).val() ;
if (defaultInputValue == "0") {
irisOrder = parseInt(editor.field( 'irisOrder' ).val()) ;
colbyOrder = parseInt(editor.field( 'colbyOrder' ).val());
finalOrder = irisOrder+colbyOrder;
while (finalOrder % caseQty != 0) {
finalOrder = finalOrder+1;
}
editor.field( 'finalOrder' ).set(finalOrder);
}
}
} );
it comes back with an error that caseQty isn't defined. Basically what I want from it is this:
If the finalOrder fields is 0 (which it is by default), give me the sum of two other fields in the row (important to only include the current row) and check if it is divisable by another field...
Any help?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Is the error from line 3? Is
caseQty
defined as a field?Colin
Yes, it's from that line but caseQty is defined...part of the definition below:
If you are running your JS in strict mode you'll need to define
caseQty
as a variable - e.g.:If its not that, can you link to a page showing the issue please?
Allan
That was it Allan...I can't believe I missed that. Thank you for having the insight to even think of that