Select Box / Radio Challenge

I have a form where about half way down, the user enters up to 3 legal names. Each name is a string qodlysource: owner1name, owner2name, owner3name.

Further down the page they need to match somethings with ownernames. ie: the user Selects the desired owner from a list or radio that is associated with, say, a date of birth for example,---- ie for 02/27/1967, select the associated ownername, for 01/01/1985, etc.

Getting the a list of the ownernames the user entered further up the page to populate a radio or select box further down the page has been challenging. Thx for any guidance on how to create a select or radio further down the page that will update itself with the names of the owners that are entered or edited further up the page. Open to other approaches as well.

Hello Robert,

Could you provide us with a screenshot of your form to better understand your case?

Do you want something like this?

In the example above, once you save an owner’s name, the select box below, bound to the list of owners, will automatically get refreshed and will pre-select the newly added entry. You can then continue updating related fields, such as the selected owner’s birthdate, and so on ..

Visitors go here to register/open a new account with us. They go through each tab left to right, entering and validating data to open the account. The last 2 steps are to enter up to 3 account owner/holders, then, finally, to setup the online access for individual (natural person) online users/account signers. Each signer/user on the last tab must be authorized by/associated with one of the owner names setup on the second to last tab.
HERE IS THE INITAL SCREEN:

HERE IS THE OWNER SETUP TAB:

AFTER UP TO 3 ACCOUNT HOLDERS/OWNERS ARE ENTERED
SINGERS/USERS ARE SETUP ON THE LAST TAB WITH THE SELECT FOR AUTHORIZING OWNER. I have been trying to get a select or radio for each user populated with the names of the account owners added on the previous tab.

Did you try using shared qodlySources? For example, in the Account owners tab, you can consider each owner input as shared QodlySource of type User (or your corresponding entity), fill the related properties. Once the owners are validated (like in your second image), the shared qodlySources will continue to hold the validated values.

Then, on the Online Access tab, you can set each select box’s selected element with the same shared data source. Specifically:

  • Assign the shared QodlySources as the selected items for each corresponding select boxes.
  • This way, when you navigate to the signer setup, the select boxes will already have the owner names available and bound, reflecting any updates made in the steps before.

Here is my challenge. Qodly sources cannot be of type Collection. But the Select Box component only allows types of Collection or Entity Selection. I tried a function that takes each owner object as the 3 parameters and returns a collection, then tried to map that returned Collection to an array type component (the only option available), but the data is just not coming through to the Select Box. I do not save any data to the database until all the tabs are completed.

To which namespace does your output collection belong? Are you sure your collection is properly populated in your code?

In the first step, I created three text inputs, each bound to an object property (obj1.name where obj1 is a shared qodlysource of type object).Then after doing the same thing for the two remaining inputs, on the button click, I pushed these objects into a collection and returned it in a shared qodlysource of type array,

Code sample that you can update according to your use case:

exposed function addToCollectionM(data1 : object, data2 : object, data3 : object) : collection
	var newC : collection = newCollection()
	if (data1 != null)
		newC.push(data1)
	end 
	if (data2 != null)
		newC.push(data2)
	end 
	if (data3 != null)
		newC.push(data3)
	end 
	return newC

In step 2, after navigating to the next page (similar to your case where you’re moving across steps), the collection is fully displayed correctly in both the select box and the matrix:

Small demo:

example

If that’s what you’re trying to do, then make sure to carefully check:

  • What your function is actually returning,
  • To which namespace your output collection belongs
  • That the bindings in the select box are correctly set

I could be my function is simply not returning anything and I need to investigate further. The function below should return a collection but i can only map it to an array qodlysource. I setup most qodlysources in namespaces because those are shared across pages. I have 3 qodlysources which are objects. (1 for each of the 3 potential account owners). When the user clicks on the tab component, the value of each owner object should be passed to a function that returns a collection of the 3 owner objects that is mapped to the ownernames array qodlysource for the Select Box.

ie: The Tab component is clicked and this function is executed:

exposed Function updateOwnerNames(owner1:object,owner2:object,owner3:object) :collection
var myCol:collection
myCol = newCollection(owner1,owner2,owner3)
return myCol

The retuned collection is mapped to the ownernames array which is the source for the Select Box. In the text part of the Select Box I use: $This.legalname to display that attribute of the owner objects.

Embarrassed. Apologies. Looks like no issue setting up an array qodlysource that is passed a collection from a function result for use in a selectbox.

The reason I was getting nothing in the Select box, was that I had not deleted 3 old qodlysources I was using before during previous efforts: owner_1, owner_2, and owner_3.

The function was taking these 3 owner sources as params instead of owner1,owner2, and owner3.

Very embarrassed and grateful for the help. All working well now!

No worries at all! The important part is that you identified the root cause and everything is working as expected. Feel free to reach out anytime if you need anything else!

It stopped working again? I have setup a shared array, “owners”. The array contains 3 owner objects. each owner object has an attribute “legalname”

When I change the legalname of any owner object on the page, a function is called to update the owners array with the latest values for each owner object.

The owners array does seem to update correctly when i change the name of an owner. I displayed it in a dialog to verify after i updated the ownernames.

[{“ID”:“”,“entitytype”:“”,“legalname”:“myfirstownername”,“taxid”:“”,“state”:“”},{“ID”:“”,“entitytype”:“”,“legalname”:“mysecond”,“taxid”:“”,“state”:“”},{“ID”:“”,“entitytype”:“”,“legalname”:“mythird”,“taxid”:“”,“state”:“”}]

I add a selectbox to the page
I bind it to the owners array qodlysource
inside the stylebox within the selectbox, I bind the text to $This.legalname

When I run and click to see options i get no options? ugh.

Maybe still something Im doing but Im stuck.

The update function:
exposed Function updateOwnerNames(owner1:object,owner2:object,owner3:object) :collection
var myCol:collection
myCol = newCollection(owner1,owner2,owner3)
return myCol

Since your function seems to be correct and returns the expected output, make sure that the QodlySource bound to the SelectBox is actually using the same array as the function’s output. Also verify that it’s bound to the correct namespace (local or shared), and that both the function output and the SelectBox source refer to the same array instance within the same namespace.

RECORDING

Thanks. Had more time this afternoon. Really strange. Its like there is some kind of lag time for it to work. I did not change anything but now it is working most of the time. Sometimes I click the Select Box and nothing happens. Click a few extra times, nothing. Then I poke around in edit mode, not making any real changes, go back to preview, and it works fine, then go back in, hit or miss. Very odd. Im trying to discern if its some pattern of clicking things I do in order that throws it off, or if its just jaggy? The array component itself updates flawlessly from the function. The Select Box just seems to get hung up sometimes.

Hesitantly saying I have solved it. The function to update the owners array component bound to the Select Box was triggered from the “onclick” event of the tab component. Everytime someone clicked on the tab component the updateowners function was ideally called.

This has had had unreliable results for whatever reason.

I went in and changed the updateowners function to instead be executed as part of the onchange event of the owner1, owner2, and owner3 objects.

This seems to work like a charm now. Something it just may have not liked about executing the function using the onclick event of a tab component.

That’s my best guess. Looks and works perfectly and consistantly now with that change.

Thx…

Another Select Box question:

All is working except that whenuser finishes the section with the select boxes, and clicks a button to validate the data, all works well and the data in the objects and on the page remains as entered and any validatyion errors are displayed. However, the Select Boxes all lose their selected values when the validate function is called?

Is this normal select box behavior? All the other values entered into text inputs, radios, etc. stay in place.

Unless you’re explicitly updating the selected element’s value or clearing it in your code (for example, resetting the state that controls the select boxes during or after the validation function), the selected values of the select boxes should remain as they are, just like with text inputs, radio buttons, etc.

Are you perhaps resetting or modifying the selected values when the validate function is executed?