?
Solved

Get value from combobox into a textbox

Posted on 2003-03-19
18
Medium Priority
?
411 Views
Last Modified: 2013-12-18
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
0
Comment
Question by:katarinabeg
  • 9
  • 7
  • 2
18 Comments
 
LVL 63

Expert Comment

by:Zvonko
ID: 8165440
Is this for web user?

Is your Domino R5?

0
 
LVL 63

Expert Comment

by:Zvonko
ID: 8165579
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


0
 
LVL 63

Expert Comment

by:Zvonko
ID: 8165596
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.


0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 63

Expert Comment

by:Zvonko
ID: 8165616
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 :-)

0
 

Author Comment

by:katarinabeg
ID: 8165961
Hi Zvonko!

No it is not for web and yes R5 platform!

Thanks!

BR
Katarina
0
 

Author Comment

by:katarinabeg
ID: 8165973
Hi Zvonko!

No it is not for web and yes R5 platform!

Thanks!

BR
Katarina
0
 
LVL 9

Expert Comment

by:Arunkumar
ID: 8166107
That will be a piece of cake for my Zvo-Bro!

:)
0
 
LVL 63

Accepted Solution

by:
Zvonko earned 2000 total points
ID: 8166297
Thanks Bro :-)

Ok Katarina, here we go.

On your "customer" Form put this @Formula behind your "add machine" button:

@DialogBox("machine")

On your "machine" Form you have to copy all Fields from "customer" Form which you like to set. I mean you have to copy "Patric", "Tomas", "Linus", "Nora", "Olaf" and "Anna" fields to "machine" Form.

You have to set in second tab of "machine" Form properties this attribute: FormulasInheritValuesFromSelectedDocument

Ok, and this LotusScript you have to have in your QueryClose event of "machine" Form:
Sub Queryclose(Source As Notesuidocument, Continue As Variant)
     Dim FieldName As String
     Dim doc As NotesDocument
     Set doc = Source.Document
     If (Source.FieldGetText( "frontbrand" ) = _
     Source.FieldGetText( "rearbrand" )) Then
          FieldName = Source.FieldGetText( "frontbrand" )
          Call doc.ReplaceItemValue(FieldName, Left$(FieldName, 1) & "2")
     Else
          FieldName = Source.FieldGetText( "frontbrand" )
          Call doc.ReplaceItemValue(FieldName, Left$(FieldName, 1) & "1")
          FieldName = Source.FieldGetText( "rearbrand" )
          Call doc.ReplaceItemValue(FieldName, Left$(FieldName, 1) & "1")
     End If
End Sub

Good luck,
Zvonko

0
 
LVL 63

Expert Comment

by:Zvonko
ID: 8166340
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.

0
 

Author Comment

by:katarinabeg
ID: 8166759
You´re an angel!Everything is working as I wanted!

Thank you SO very much!

Have a nice day!

Best Regards
Katarina
0
 
LVL 9

Expert Comment

by:Arunkumar
ID: 8166974
Thats why my bro is here for Katarina !
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 8170271
(: smile :)
0
 

Author Comment

by:katarinabeg
ID: 8172078
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
0
 

Author Comment

by:katarinabeg
ID: 8172119
Sorry, Im tires today and didnt look until I asked the question, this is already working!

/K
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 8172190
No problem at all :)
0
 

Author Comment

by:katarinabeg
ID: 8172372
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
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 8172797
I did not understand one word :)
Can you please send me your phone number to zvonko@mysite.de?

0
 

Author Comment

by:katarinabeg
ID: 8172995
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!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…
Suggested Courses
Course of the Month9 days, 17 hours left to enroll

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question