To complete the single-row layout:
selectedPayment_category_comboBox DojoComboBox{ values = PaymentLib.categories,
layoutData = new GridLayoutData{row = 2, column = 2}};
function cellClicked(myGrid DataGrid in)
selectedPayment = allPayments_ui.getSelection()[1] as paymentRec;
selectedPayment_form.publish();
selectedPayment_category_comboBox.value =
PaymentLib.getCategoryDesc(selectedPayment.category);
end

function clearAllFields(event Event in)
saveID INT = selectedPayment.paymentID; // retain the key
selectedPayment = new PaymentRec{};
selectedPayment.paymentID = saveID;
selectedPayment_form.publish();
end
The code retains the record key
for use in a subsequent update of the database. The code then creates
a record, assigns it to the selectedPayment variable,
assigns the saved key value to that variable, and publishes the variable
to the single-record layout.function selectedPayment_form_Submit(event Event in)
selectedPayment_category_comboBox.value
= PaymentLib.getCategoryNum(selectedPayment_category_comboBox.value);
if (selectedPayment_form.isValid())
selectedPayment_form.commit();
selectedPayment_category_comboBox.value =
PaymentLib.getCategoryDesc(selectedPayment_category_comboBox.value);
// update allPayments with new version of selectedPayment
for(i INT from 1 to allPayments.getSize())
if(allPayments[i].paymentID == selectedPayment.paymentID)
allPayments[i] = selectedPayment;
exit for;
end
end
call dbService.editPayment(selectedPayment)
returning to recordRevised
onException serviceLib.serviceExceptionHandler;
end
end
if (selectedPayment_form.isValid())
A problem arises with the Dojo combo box for Description, because the widget content is of type STRING and the related field is selectedPayment.category, which is of type INT. The validation of the Dojo combo box requires that combo box include either integers or strings, such as “1” or “20,” that can be converted to integers.
selectedPayment_category_comboBox.value
= PaymentLib.getCategoryNum(selectedPayment_category_comboBox.value);



In the next lesson, you install Apache Tomcat on your system so that you can run your application on a web server.