I have a form that only has one editable field. It is a dialog box that does a view lookup. (and I must be able to add new values that aren’t in the view lookup).
I would like to do one or both of the following:
-
Upon creation of the document, immediately automatically click the drop down arrow next to the dialog box, thus saving the users a click.
-
Even more, I’d like to save and close the document upon them making a selection. I tried the OnChange field event, but that doesn’t allow for new values or selection of a value if there are two choices that start with the same letter (i.e., if you type in N it selects the first choice that starts with N and saves/closes).
Any ideas?
This will not be used on web, just in Notes.
TIA
Subject: Dialog Box display / save
If you place the same formula that is in the lookup value for the field into the default value for the field, it will prompt with that list.
Then, If you place a formula in the Input Validation something like
@if(field != “”; @do(@command(filesave); @command(closewindow) ); “”) It should save and close once a value is entered.
This way, everything is contained in the field itself.
Subject: RE: Dialog Box display / save
I was very excited to see this possibility. Seems very straight forward.
But when I put this dbcol in the default, ALL my choices are listied in a big long string. Still need to use the helper arrow to select the ‘real’ one (and erase all others that don’t apply).
And the input validation formula of
@If(Account != “”;@Do(@Command([FileSave]); @Command([FileCloseWindow])); “”)
doesn’t force the save/close when the field is filled in. I do have ‘refresh fields on keyword change’ selected thinking that would do the validation but it didn’t.
Am I missing a key element in your solution??
Subject: RE: Dialog Box display / save
Tammy,I tried it and you are correct on both points. Sorry about the confusion, I wanted to try to get something that worked for giving the wrong info last time so I came up with a different method and tested it first:
First: I placed the following code in the default value of the field:
(please note - the field name that I used was lookuptest)
lookuptest := @If(@IsNewDoc;
@Prompt([OkCancelList]; “Select Value”; “defait choice”; “Please select a value from the list”; @DbColumn(“”:“NoCache”; “”; “yourviewnamehere”; 1)); “”);
@SetField(“lookuptest”; lookuptest)
Then - in the PostOpen event of the form I placed this code:
If source.FieldGetText(“lookuptest”) = “yourintendedvalue” Then
If source.editmode Then
Call source.Save()
Call source.Close(Immediate)
End If
End If
And it worked - I was able to prompt with a list and if the intended value was selected, a document was saved to the db.
Subject: RE: Dialog Box display / save
It works both ways:
I was able to prompt with a list and if the intended value was selected, a document was saved to the db.
If the intended value was not selected, the document opens in edit mode and the selected value is placed in the field.
Subject: THANKS! Dialog Box display / save
Through a combination of all your ideas, I finally could put this all in the button on the page (and could leave field as text/editable with no default value and no code in postopen). They still need to click the ‘helper arrow’ but the rest is quite automated. Thanks for your time!
@Command ([Compose];“” ; “Call”);
@UpdateFormulaContext;
@SetField(“Type”; @DbLookup(“”:“NoCache”;“”;“Lookup Types”;“1”;2));
@SetField(“Action”; “Received”);
Account := @If(@IsNewDoc;
@Prompt([OkCancelEditCombo]; “Select or Enter an Account Name”; “”; “”; @Unique(@DbColumn(“”:“NoCache”; “”; “Lookup Accounts”; 1))); “”);
@SetField(“Account”; Account);
@If(@Command([FileSave]); @Command([FileCloseWindow]); “”)
Subject: Dialog Box display / save
Tammy,
I’d probably just make the field be computed when composed and put a button next to it that would bring up a dialog box.
I’d then put PostOpen code into the form that would bring up that same dialog box (if user is in edit mode, or new doc, whatever). Now, whenever someone comes in in that mode, the dialog box pops up automatically.
And you can have code that checks for the user hitting OK and that code could then save/close the document. Same code in PostOpen event and in button next to field.
regards,
raphael
Subject: RE: Dialog Box display / save
So I changed my button on my page to do this:
@Command ([Compose];“” ; “Call”);
@UpdateFormulaContext;
@SetField(“Action”; “Received”);
Result := @DialogBox(“Account”; [AutoHorzFit] : [AutoVertFit] );
@If(Result = 1;@If(@Command([FileSave]); @Command([FileCloseWindow]); “”);“”)
So once the selection is made, the ‘Result’ flag is forcing the save/close. Excellent. But upon compose of the document when it brings up the dialog box, I still have to click the helper arrow to see my choices. Any way to force the clicking of the arrow?