DBColumn - OnSelect

I have a dialogbox 'CustName' with a @DBColumn to get its selection values.  Once the user has selected the value from the dialog box I have a number of editable fields e.g 'address','phone' which I want to populate by a DBLookUp to a view for the details.

How can I do this? Do I use the OnSelect?
fayebAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ArunkumarCommented:
Use @DbLookup to find the matching values by passing the selected value. Then populate the values on the fields. If these can be computed they can automatically populated if they are editable then you might have to look for some roundabout way like clicking a button or writing the code in appropriate events (not an efficient way though).

Check @DBLookup help on details of how to get the values.

-Arun.
0
fayebAuthor Commented:
They have to be editable as users have to be able to add a new cust as well as select new ones.
0
CRAKCommented:
You could also use @Picklist instead of the @Dialogbox, and retrieve @Text(@DocumentUniqueID) from a hidden column.
Using @GetDocField you could obtain one or more fields without additional (slow) @DbLookups.
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

fayebAuthor Commented:
The application is web so I cant use @picklist
0
fayebAuthor Commented:
The application is web so I cant use @picklist
0
CRAKCommented:
For the web I often use a different approach. I prefer this method because it doen't need any refreshes or (slow) @DbLookups. I haven't got a working example around, but if you know some javascript, here's how it works:

Create a page or form. It's contents should be interpreted as HTML.
On it you place a view in HTML, delivering the options for the HTML select statement, providing the text (what to select) and the values (alias). The values can be the concatenated value for the different fields, like:

  <OPTION VALUE="value1@value2@value3">Choice 1
  <OPTION VALUE="valueA@valueB@valueC">Choise 2
  <OPTION VALUE="valueX@valueY@valueZ">Choise 3

Add the proper HTML around it:

<SELECT NAME="myField" onChange="
  i = this.selectedIndex;
  v = this.options[i].value.split('@');
  opener.myFunction(v)" Size=5>
...(place the view with the options here)...
</SELECT>

And you've got the engine for a dialogbox in HTML/Javascript.

The opener window (where you trigger the dialogbox) should contain a javascript function to receive/distribute the field values:

function myFunction(v)
{
  document.forms[0].Field1.value=v[0]
  document.forms[0].Field2.value=v[1]
  document.forms[0].Field3.value=v[2]
}

All you have to do now is change the current action that opens the dialogbox into a javascript window.open(), launching the page or form. Depending on wether you use a $$viewtemplate or an embedded view, you should open the view's or the page/form's URL.
From the action, the function or even in the onChange, you should be able to close the opened pop-up window again.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
HemanthaKumarCommented:
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.