Prompt validation (OpenInsight 64-bit)
At 22 NOV 2019 09:42:36AM mdaniel wrote:
Good morning,
Hopefully this is a trivial question.
A form includes a prompt that will accept a record ID or nothing in the edit field named EF_BUYERCONTRACT. If nothing is entered, form assumes to create a new record but requires confirmation from the user. Therefore, created a LostFocus event that displays a yes/no message "Want to create a new Buyer Contract". If they enter yes, the form prompts are initialized the moves to the next input prompt. If No is selected, it should return back to the EF_BUYERCONTRACT prompt.
The following syntax does not work. Does a different solution work such that if the validation/confirmation fails then prompt control returns back to the previous/original prompt?
Also, when exiting the event script what is the difference between Return 0 and Return 1?
rtnValue = 1BuyerContractId = Get_Property(@Window:'.EF_BUYERCONTRACTID','TEXT')If BuyerContractId = '' ThenMsgDef = ""MsgDef<MTEXT$> = 'Want to create a new Buyer Contract'MsgDef<MTYPE$> = 'BNY'response = Msg(@Window,MsgDef)Begin CaseCase response = 1 ; Gosub initForm ; * selected yesCase 1 ; Call Set_Property(@Window:'.EF_BUYERCONTRACT','FOCUS',1)rtnValue = 0End CaseEndReturn rtnValue ; * still don't understand what 0 or 1 does for rtnValue.
initForm: ; * get the record from remote source and populate prompts
Return
Mike Daniel
480-699-0212
At 22 NOV 2019 10:03AM Andrew McAuley wrote:
The last question is the easy one.
Event flow in 9.4 is effectively
User Code (Event Handler) → System Event Handler → Quick Events
(It can be forced to be different in 10).
If You return 0 from your Event Handler, the chain terminates. If you return 1 the SEH and QE (if present) execute.
How does your code fail?
World leaders in all things RevSoft
At 22 NOV 2019 10:46AM mdaniel wrote:
If No is selected, the prompt still proceeds to the next prompt instead of returning to the original (EF_CONTRACTBUYER) prompt where they prompted to enter a value.
In short and I may be misunderstanding what this statement does:
Call Set_Property(@Window:'.EF_BUYERCONTRACT','FOCUS',1)
Does not return control/focus back to that prompt.
Mike Daniel
480-699-0212
At 22 NOV 2019 12:32PM mdaniel wrote:
It does work! Sorry…
I shorted the field name - EF_BUYERCONTRACT. It works when referencing the actual field name EF_BUYERCONTRACTID.
Mike Daniel
480-699-0212
At 22 NOV 2019 12:42PM Andrew McAuley wrote:
I did wonder as it looked fine :)
World leaders in all things RevSoft
At 22 NOV 2019 01:59PM mdaniel wrote:
Ya… my faced did turn red after noticing it.
Thank you very much for the feed-back.
Mike Daniel
480-699-0212
At 25 NOV 2019 06:58AM D Harmacek wrote:
Just a comment. Instead of accepting an empty entry value for the key, then ask for confirmation: Place a small button labeled "New" next to the prompt. Thus, the interface is self-documented.
At 25 NOV 2019 07:30AM mdaniel wrote:
Thanks for the tip. The form does include that button. My next step is to activate that button when nothing is entered in the record id prompt. Or perhaps making the record id prompt a required entry unless the new button is pressed. Now that I think more about your suggestion, this does make the best sense and is more intuitive.
I'm still trying to determine "best practices" and define a standardized user interface which is implemented across all forms. Fortunately, most of it is already provided in the base product. Since this form's data along with potentially numerous other form's data fields will be referencing and updating existing SQL tables via stored procedures, I'm trying to figure out if its possible or feasible to somehow bind the data with different stored procedure types. This topic was posted earlier today.
Mike Daniel
480-699-0212