How to call control ID in Client side human interface? - ibm-bpm

I have two templates built in coach view and I have added them to a client side human interface. How do I implement a common logic between them?
Coach view 1
--------------------------------
button 1 button 2
--------------------------------
Coach view 2
----------------------------------
Text box
----------------------------------
I have two radio buttons in one and a text box in the other. If I press either one, I want to set a text, e.g. hello and bye.

You should give each button their own control id name, so you know which button they are, like "button1", "button2". Then bind each button to the same string variable, which needs to be a configuration variable in the view or business object bound to the view. When each button is clicked, they will cause the change event to fire because the bound variable is updated, and the value or property of that change will be the control id of the button clicked. I am assuming your text box is bound to a variable in it's coach view also. When you detect a change event, if the value is "button1", then set the value of the string of your text box to whatever text you want. If the value is "button2", set the value of the text box to the text you want. I don't have access to the code I recently did for this or I would give you a more accurate syntax.
I would probably have a configuration variable for each coach view above, one named something like "buttonClicked" and bind each button to it. Then one bound to coach view 2 like "displayText". If either one changes, it's going to fire off a change event, which is why you want to use if/else to make sure the change is "button1" or "button2". If button1 changes, then this.context.config.displayText.setValue("button1 clicked").

Related

How to make pop-up data reflect selected record?

The case:
I have Activities as datamodel.
I have set Activities to have many-to-many relationship with themselves to represent a Parent / Child relationship.
I have set up an accordion widget. Each row of the accordion contain basic data about the Activity record + some buttons.
I have set one of the button's onClick functions to open a popup, which allows me to edit the Activity detail in a form.
When I click a different record from the same accordion, the form from the popup reflects the data in the selected record.
The problem:
I have nested accordions which represent the "Child" Activities of the Parent Activity.
I have also added a similar button, which opens a popup. I can open the popup, which targets the child records, but cannot make it open the specific record, from which I pressed the button.
So the popup open by default on the first child.
Please help - how can I make the popup change naturally to reflect the datasource / selected record of even nested datasources?
What I tried:
In order to try and make to popup work I have tried to set the datasource based on the relationship:
Activities: Sub_Activities(relation)
This works to the extent of showing the related items, but popup content does not dynamically change on clicking a different child record or clicking the button from a different child record.
In both cases what is shown is the first child record.
What I understand is that you have a set up in which you click a button and a popup shows. The popup should let you view/edit the record referenced in the row where the button is. If that is the case, then probably you already have almost everything setup for the next thing to work. First, add a string custom property to the popup and name it selectedKey. Then, on the onClick event of the button that opens the popup, add something like this:
var key = widget.datasource.item._key;
app.popups.MYPOPUP.properties.selectedKey = key;
app.popups.MYPOPUP.visible = true;
Now, go to the popup content and add the following on the onAttach event handler:
var key = widget.root.properties.selectedKey;
widget.datasource.selectKey(key);
This is the general idea of how to make it work; However, in order for it to work, your datsources in the widgets should be properly set up. Good luck!

Using bindings with BrazosUI buttons

I'm used to using boolean bindings with IBM buttons to track if a button is clicked. The button in Brazos UI can be bound to any variable type but doesn't make automatic updates to booleans. How do I use bindings with Brazos UI buttons to track which was last-clicked?
The binding of a button is really only useful in tables. The acceptance of ANY variable type for the binding of a button stems from the use of determining the index of a selected row or obtaining the entire row object:
If you bind and integer to the button in a table, the binding will update with the index of the row when the button is clicked.
If you bind a variable of the same (singular) type as the table's binding, then clicking the button will update the binding with that row's data.
Both of those are handy interactions with the table control but don't work for tracking which button is clicked when used elsewhere on a coach. For that, you want to utilize the 'Button Control ID' configuration option. The most direct method is to bind the same string variable to all of the buttons you need to track. When clicked, a button will update that shared variable to match its own control ID. You can then use that unique ID in various scripting checks to take button-specific actions.
See the BP3 Help Center article for greater detail about this, including some examples: https://support.bp-3.com/hc/en-us/articles/217985767-Using-Button-Binding-with-Brazos-UI

Removing drop-down arrow from a Lookup Field on an Access form

I know this is a low level question, but I am "annoyed" that on my forms which are for read only purposes, i cannot figure out how to remove the drop down Arrow box on fields which are linked to a list of records..
Does anyone know if this can be done??
If you have a Lookup Field in Access and in the Design View of a form you drag it from the field list onto a form you'll get a Combo Box control. Combo Boxes have the little drop-down arrow tacked onto the end.
To get rid of the drop-down arrow simply replace the Combo Box control with a Text Box control. That is, create a Text Box control on the form and set its Control Source property to the name of the lookup field, then delete the Combo Box control. The Text Box control will display the selected value(s) of the lookup field but will not allow you to edit them.
There is an easier method than Gord Thompson's. This is in Access 2010 and may be applicable to other versions. In either Design or Layout View, right click on the combo box control and go to "Change To" then select text box.

Specifying Other Amount on Initial Web Page

I have a form that contains a drop-down selector for someone to choose from one of three items to make a payment. I am trying to add a fourth item so that someone can specify their amount on the initial web page before clicking the "pay with paypal" button I created.
The ID of my text input box for the "other amount" is: amount1
Is it possible to use the advanced variables section of the Paypal button generator to have the value for the amount be set to the value from this text input box.
option_amount3 is the variable name that refers to the fourth option in the drop-down selector, so can I do something like: option_amount3 = [some way to grab the value typed into the text input box]
Here's a link to the page:
http://freeonlinetherapy.net/index_dave.html
Please advise.....

How to change a View from inside a view

I have one .mxml file (the Application) with a ViewStack (with 4 views) and a ControlBard, obviously I can change the views with it, but what I want to do is: in view #1 I have an image which I want to convert to a "hyperlink", so when I click it I go to View #2, is this doable? Also I would like to pass somehow some data (like a String) to that View #2 (lets say the it's a user avatar I click so I want to go to the second view which will show me his profile, that's why I need his name/id).
One way, loosely coupling, Create a custom event (SelectAvatarEvent?) with a property for name/id and dispatch it from View1 when the link is clicked. In the Application add an event listener for this custom event, and catch it, change the view index to View2 and create a function/property in View2 that you can pass the string/event to. Depending on how it is implemented, might need to account for delayed instantiation of View2.

Resources