Link to home
Start Free TrialLog in
Avatar of katarinabeg
katarinabeg

asked on

Get value from combobox into a textbox

Hi!

I have a database with two forms the first form is called "customer" and on this form there is a button called "add machine" which is calling a second form called "machine". On the form called "machine" I have a combobox called frontbrand and another combobox called rearbrand the values in the comboboxes I entered manually, there is 6 different names to choose between in the comboboxes e.g (Patric, Tomas, Linus ,Nora,Olaf ,Anna) (same names in both comboboxes). On the first form which is called "customer" I have a 6 text boxes one for each name, now, if the users selects Anna in one combobox and Olaf in the other I want these choises to be presented in the text boxes like A1 and O1 and if Anna is selected in both comboboxes it should be presented in the textbox A2.
Please does anyone know how to solve this?

Thanks in advance!

Katarina
Avatar of Zvonko
Zvonko
Flag of North Macedonia image

Is this for web user?

Is your Domino R5?

Ok, I assume R5 and web user.

Then put a button on your "customer" Form with this @formula:

@SetTargetFrame("_new");
@Command([Compose];"add machine")

Your Form "add machine" does nedd this in Form's JSHeader section:

resizeTo(600,400)
function setSelection(){
  o=opener.document.forms[0];
  f=document.forms[0];
 if(f.frontbrand.selectedIndex==f.rearbrand.selectedIndex){
    selVal = f.frontbrand.options[f.frontbrand.selectedIndex].text;
    o[selVal].value=selVal.substr(0,1)+'2';
  } else {
    selVal = f.frontbrand.options[f.frontbrand.selectedIndex].text;
    o[selVal].value=selVal.substr(0,1)+'1';
    selVal = f.rearbrand.options[f.rearbrand.selectedIndex].text;
    o[selVal].value=selVal.substr(0,1)+'1';
  }
  window.close();
  return true;
}


Form "add machine" needs also a button with this JavaScript code:
setSelection()


That is all.

Good luck,
Zvonko


Oh, "add machine" was a button on "customer" Form. And "machine" was the popup Form.

So put this @Formula in "add machine" button:
@SetTargetFrame("_new");
@Command([Compose];"machine")


And all the JavaScript code is of course for "machine" Form.


Important thing: JavaScript is case sensitive!!!

The consequence of this is that your combo values have to have exact character matching to "customer" Field names. The same is for combo Field names. They have to match to JavaScript references.

Best is to do it like you did: write all in lowercase :-)

Avatar of katarinabeg
katarinabeg

ASKER

Hi Zvonko!

No it is not for web and yes R5 platform!

Thanks!

BR
Katarina
Hi Zvonko!

No it is not for web and yes R5 platform!

Thanks!

BR
Katarina
That will be a piece of cake for my Zvo-Bro!

:)
ASKER CERTIFIED SOLUTION
Avatar of Zvonko
Zvonko
Flag of North Macedonia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Oh, and of course you can make this copy fields on "machine" Form hidden for user by setting hide-when option to hide from Notes Client.

You´re an angel!Everything is working as I wanted!

Thank you SO very much!

Have a nice day!

Best Regards
Katarina
Thats why my bro is here for Katarina !
(: smile :)
Hi it´s me again!

One more question according to this....
If I want to choose yet another machine for the customer I want the textboxes to add more of the name selected. If I he first time added a machine with the names Anna and Nora it cames up A1 and N1 and if the customer has another machine with the name Patric and Thomas i want the line to add P1 and T1 to the textboxes...(hmm, confusing?)
Please let me know if you want me to create antoher case with new points for this!

Regards,
Katarina
Sorry, Im tires today and didnt look until I asked the question, this is already working!

/K
No problem at all :)
OK another question....
On the machine form there is 8 comboboxes where to select diffrent values, on the first form called "customer" I have created 8 textboxes to gather the information from these 8 comboboxes after you helped med with the script and all the information is collected correct. But then I thought of one thing, if the customer has more than one machine I would like to create a list of his machines, e.g I want the 8 textboxes on the "customer" form to expand with one line per machine. As it is today I only can gather information about one machine and then if I try to add another machine the 8 textboxes changes to the new machine instead of adding a new line...., on the other hand the textboxes I asked you about yesterday P1, N1 etc is increasing when adding a machine to P2,N2 etc...( if you need more info pls let me know?)
And as before, let me know if you want more points, I still have some left!

Regards
K
I did not understand one word :)
Can you please send me your phone number to zvonko@mysite.de?

I do not blame you for not understanding, I would not do it either if I did not know how the database looked like! I have sent a description of it to you!
Thanks!