I've done this very easily on the desktop side using xbasic, but I'm stumped on how to do this on the client side using javascript.
I have a UX component with a number of required fields. If the Status field is Pending or Void, the required fields do not need to be filled in. However; if the user tries to change the Status to Ordered, I want to stop the change if the required fields are Not filled in.
Initially, I started with a lookup edit-combo for the Status field, but there is only a OnChange event. I want to prevent any change, not wait until a change has been made.
So then I tried a button to change the Status. The following code works well to stop the change. But I can't figure out how to create a simple select list to pass the new choice to the Status field.
Not sure what to do next. I have spent 2 days on this and right now I'm mentally exhausted.
I have a UX component with a number of required fields. If the Status field is Pending or Void, the required fields do not need to be filled in. However; if the user tries to change the Status to Ordered, I want to stop the change if the required fields are Not filled in.
Initially, I started with a lookup edit-combo for the Status field, but there is only a OnChange event. I want to prevent any change, not wait until a change has been made.
So then I tried a button to change the Status. The following code works well to stop the change. But I can't figure out how to create a simple select list to pass the new choice to the Status field.
Code:
var poStatus = {dialog.Object}.getValue('STATUS'); //check that status <> pending AND status <> Void if (poStatus != "PENDING" && poStatus != "VOID") { var controlsToValidate = ['PDATE','REQ_FOR','TAIL_NUM','V1','S1','SHIP_HOW','REQ_BY','APPROVE','WRITTEN']; var flagHasError = false; var result = ''; for (var i = 0; i < controlsToValidate.length; i++) { result = {dialog.object}.clientSideValidateField(controlsToValidate[i],1); if(typeof result == 'string') flagHasError = true; } } //if all required fields have been filled in, open a list of choices picking just one to be entered into the status field // Choices: pending, ordered, received, Void, a blank line, Posted //after selecting one, set the new value in the status field and do a ajaxcallback to write the new value to the table //{dialog.Object}.showContainerWindow(ele,'STATUS_CHOICES'); //alert("OK"); //{dialog.Object}.setValue('STATUS',value [,honorChangeEvent] ); //{dialog.object}.ajaxCallback('','','ChangeStatus','','',{deviceOfflineFunction: function() { }});
Comment