I have this Javascript
It's a Point of Sale app.
ProductLookup() does a Lookup and Fill in Fields from the data entered into the Search field, placing the results into a Repeating Section.
resetField() just blanks out the Search field ready for the next product lookup
addNewRow() adds the new row in the Repeating Section for the next product
setNewField() sets the new row as Active.
And the A5.executeThisThenThat is triggered by the 'Enter' key. This entire script is in the onKeyPress of the Search field.
Here's what I want to do. If the product is not found in the productLookup() Lookup and Fill In Fields, I want the entire script to stop with the popup "Item Not Found". I CAN do that with the 'Not Found Action' on the Lookup, but it will continue to run the A5.executeThisThenThat items.
How do I make it stop running the script if the product is not found?
Code:
function productLookup() { {dialog.object}.runAction('LookupProduct'); } function resetField() { {dialog.Object}.setValue('Search1',""); } function addNewRow() { {dialog.Object}.addRepeatingSectionRow('CONTAINER_3'); this.value=''; } function setNewField() { var count = {dialog.Object}._getRepeatingSectionRowCount('CONTAINER_3'); {dialog.Object}.setRepeatingSectionActiveRow('CONTAINER_3',count); } var keyCode = event.charCode || event.keyCode; if (keyCode==13) A5.executeThisThenThat(productLookup,resetField,addNewRow,setNewField);
ProductLookup() does a Lookup and Fill in Fields from the data entered into the Search field, placing the results into a Repeating Section.
resetField() just blanks out the Search field ready for the next product lookup
addNewRow() adds the new row in the Repeating Section for the next product
setNewField() sets the new row as Active.
And the A5.executeThisThenThat is triggered by the 'Enter' key. This entire script is in the onKeyPress of the Search field.
Here's what I want to do. If the product is not found in the productLookup() Lookup and Fill In Fields, I want the entire script to stop with the popup "Item Not Found". I CAN do that with the 'Not Found Action' on the Lookup, but it will continue to run the A5.executeThisThenThat items.
How do I make it stop running the script if the product is not found?
Comment