Combo Box edit selection

Combo Box edit selection


I have been racking my brain trying to figure this out. I have a series of combo boxes with each of the list set to an entity. The Idea is that I want to use the combo box to select the record to edit. After selecting the record, pressing the edit button should launch the popup edit window with the data for the selected record in the combo box in the previous screen. I have tried many different ways and did get it to work at one point, but to be disappointed when the absence of any records throws an error.

The only way I could get it to work was to set the variable in the edit button i.e. the Identifier for the record to edit. I changed it from the standard local variable to the following:


Problem is, if there are no records in the selection list it returns the error "Cant find record 0" or something to that effect.

I have attach a little demo of the problem if you are not clear of my situation. Any help would be greatly appreciated. The sample combo boxes are on the "Admin" sub-menu.

Thanks in advance

I followed through the debug and identified that the varible holding the Identifier being passed, does in fact hold the correct ID. When the button is clicked to pass the varible to the popup editor, it is somehow always is changed to [0]. I cant seem to follow the debugger to see where this change occurs.
Hello Jim.

Maybe you need to add a condition to the edit button. If the Id from the Combo Box is nullidentifier, the edit button should stay disable, or invisible. In the button properties the "Enabled" should change from "True" to "ItemList1Id<>NullIdentifier()". And in the on change of the combobox call an action to refresh the Edit Button.

Hope this solve your problem.

Best regards, Tomás
The error that I get is not a problem when pressing the button, it occurs at the time the screen is rendered. Even if the button is disabled, the error occurs because of the GetEntity(ID) has a zero as the ID when there are no records. NullIdentifier() is represented as a zero I believe, so in the absense of any records, the button enabled or disabled has no bearing.
Hi Jim,

You need to refresh the Edit Button every time you choose a value in the combobox, and to do that you simply create an action and call on the onchange property of the combobox, as the image shows.

Your onchange Action just use the Ajax refresh node and select the

If more help needed feel free to ask.

now that i've read your posts let me explain some details:
  • Yes, the nullidentifier() is representative of an integer equals to 0 (zero)
  • The entity actions GetEntity and DeleteEntity when invocated with an non existing identifier (like the nullidentifier for example) they raise an exception.
  • Your problem was related to the generation of the button, because when the button was generated, the screen variable was with the 0 value, and you need to refresh the button so "he" could reassign the changed value in the variable.
Hope it help to clarify the questions.

Hi Ricardo,

  • "Your problem was related to the generation of the button, because when the button was generated, the screen variable was with the 0 value, and you need to refresh the button so "he" could reassign the changed value in the variable."
  •  I am a little confused, how can you refresh the button, the error occurs during screen render, therefore the screen is never presented, it is redirected to the error screen. Also, I am not aware how to intercept the action prior to the error in order to do a refresh, is this done in the preparation action?
  • as I said earlier, this scenario is more of a work around and doesn't seem to be the correct course of action. I believe the preferred way is to assign a varible with the Identifier and after selecting the desired item from the combo, to pass that Identifier to the input variable of the popup editor. but it seems that it only pass a zero no matter what I do. I tried an ajax refresh of the combo widget in the OnChange event, when following the debug, the variable is in fact the correct value, but when the edit button is clicked, the variable is replaced with a zero again.
  • Hi Jim,

    Check the attached espace to see the changes i've done in your Item List 1 combobox.

    I've test the espace to add a new value, and to edit an existing value and it worked just fine. I've also made some changes in the screen to be prepared to be called by a popup or by a regular submit/navigate.

    Feel free to ask, i'm here to help.

    Thanks Ricardo,

    I see the main problem I had was not including the popup widget in my OnChange refresh call when I selected an Item from the combo box. After I replaced my refresh call to include both the button and popup widget in the Div, it worked perfectly. Thanks again for your help.
    you're welcome.

    i'm glad i could help.

    Thanks  José,

    I did implement the hiding you suggested, I had an IsEdit method that was more complicated. Sometimes the simplest things are complicated by lack of vision. Your suggestion fixed the problem I had with editing a Null Identifier, not really a problem, but made it look less professional.