Fill Combobox only once dynamicaly at actionlistner - java-me

In my project i want to first view country in combobox then selecting country state should be viewed then city based on state This is done in my project but the problem is that when i am aagain clicking on country then the state corresponding to that country is appended to combobox.. this should not be done the combobox should be refreshed then state should be added I am doing this in J2Me in lwuit can any one help me ??? if any one please help me.
Thank you

It would help if you would explain how you are using combo boxes...
I'm guessing you are using addItem to add lots of items (which is bad) without removing the items.
To replace the existing items just do:
combo.setModel(new DefaultListModel(arrayWithNewData));

Related

Lotus Notes - Why is my view data missing?

I recently just constructed a new view for a Lotus Notes Application and tested it to be fine.
It was supposed to get field data from 2 nearly identical forms and display into the view. The fields on both forms share the same name.
The formula used in View Selection is
SELECT ContactName; CompanyName; ContactNumber; CarNo; RequestDate
--comment: These are the names used in both forms --
This worked fine yesterday. Also I made sure that each column has selected the correct field to display and I did not change any settings. However, today when I went back to check, the view is all empty.
What seems to be the cause of this?
Your selection formula for the view is not correct. You use the name of the forms in the select statement and then add your fields as column in the view. If we assume that the forms are called FormA and FormB, then your selection formula for the view can look like this:
SELECT Form="FormA":"FormB"

Populate Textboxes by Clicking a Table in MVC

Populate Textboxes by Clicking a Table in MVC. The Javascript code which I am using doesn't change the text boxes values when I select another row on the table.
Does anyone have an idea please help?
I have the Answer to My own question, so any one who needs it. just say the word and I'll type the problem is am using a phone right now

XPages: DropDown selection of documents

I have a VERY general question and am not 100% sure if I am just being lazy or what, I just cannot seem to get a handle on where to start :o)
I am new to XPages programming and have created an application that works well enough, the problem is that I would like to UI to be totally different to what I have. I find that my implementation is much too "Notes like" and not "Web like" enough. OK, enough whining - I have a document that contains a county, a province, a city and some text to that particular city. Currently I display a view (XPage) listing all documents by county / province / city. The user then selects the city document which is then opened to display the text. Works well enough. As you can see very "Notes like". What I would like is this: The user sees 3 drop down fields (two of which cannot be selected), s/he then selects the country from the drop down. The province field now becomes active only displaying the provinces for that Country. S/he selects the province and all the cities are now is the next drop down - once you select the city the text is displayed below the city name. Quite simple I thought - now matter what I do I cannot get this to work :o(
Any pointers (maybe an example app somewhere?).
Thanks in advance
Greetings
Ursus
First thing you should do is get a copy of the Mastering XPages book and read through that. Then you should look at how rendering and partial refreshes will help you do what you want.
You are going to want to set the rendering to false until you enter some value in the previous field. Then, in the event, you determine if the value is valid and set a flag (could be a simple viewScope) and do a partial refresh of the next field. In that field's properties, you check the viewScope flag that you just set in the previous field and if it is correct, you reset the rendering to true to show the field.
We have implemented exactly that kind of feature on the homepage of ilsschools.co.uk using client side onchange event:
var com2 = XSP.getElementById("#{id:comboBox2}");
XSP.partialRefreshGet("#{id:comboBox2}",
{ onComplete : com2.selectedIndex = 0 });
We get the element we want to refresh (i.e. comboBox2 and we do this for comboxBox3, 4 etc as well). Then we use partialRefreshGet to refresh the choices in comboBox2, this can be repeated for 3, 4 and other comboBoxes as well. You can compute the disabled property of a comboBox to disable it. You can compute the selections for a comboBox using SSJS.
Hope this helps.

Save Infopath form w. dynamicly created fields in Sharepoint 2010 Library

I am very new to Infopath, and need some architechtual guideslines. My scenario is as follows:
I have a Sharepoint list, let's say it contains beer, and three items of it: "Kronenbourg", "Corona", "Tuborg". "Beer" is a content type, derived from Item.
What I need to do :
I need to create a "dynamic" Infopath form, that presents the user with a CheckBox for each beer. If a new beer is added to the Beer list, a new Checkbox should show up on the form without intervention, even on saved instances of the form. I have not decided what should happen upon deletions.
I then need to save this infopath form, including the selections, in a sharepoint form library, so that the users can go back to one of maybe many beer-forms that they have saved, and maybe change the selections.
I also need to build a string from the selections at some point in time, and present this string in a visible column in the form library, but thats beyond the scope of this post.
What I managed to throw together so far:
I have a kind of working Infopath form. I have added a sharepoint dataconnection to the Beer list, and dragged a repeating table to the design area. This "works", i get a list of my list items. I then added dummy Y/N field to my beer content type, selected it in the fields, and now i get a neat checkbox next to my records.
Obviously this does not seem right. I do not need to save anything back to the Beer table, I only need to use the beer table for lookup, and keep the selected choices in the saved instance of the form.
Ok, thanks for staying with me so far. What do I do here, can Infopath be persuaded to support a scenario like this, or am I better off building custom webparts? I think my main questions are:
Can I maybe attach an "input-only" CheckBox to a repeating list/section ? (and how do I refer to such dynamically created control)
How do I make Infopath load the choices dynamicly from db, but save the data in the instance of the form?
Should, and can I maybe attach a content type to the form library, representing the choices and somehow attach that to the form?
Thanks for any input
If I understand your requirements, I think the thing to do here is to use a Multi-Selection list box (MSLB). This can have its values populated from a secondary data source (i.e. a list), and it would be bound to a repeating field that would automatically have values added and removed as values are selected and deselected.
As far as getting the selections into a single string, if you just want this value for a column of the form library that the forms will be submitted to, you can just use this repeating field as a promoted property, and use the "Aggregate" option to combine the values into one.
The other option would be to create a separate field to hold the string and use the "double eval trick" (please Google that) to combine the values into one. One gotcha here is that if you use double eval trick with a MSLB, you have to put the formula both in a rule on the MSLB's field, and in the default value formula for the target field.

XPages - populating multiple fields on typeahead selection

This might be a straightforward question but I can't see wood for trees at the moment
Problem: I have a typeahead attached to an edit box that looks up values from a view (based on Tim Tripcony's code). When a value is selected, I want other edit boxes on the XPage to be populated with values pulled from the corresponding document.
As an example: A username edit box has a typeahead looking up from the NAB. I select "Joe Bloggs" name from the typeahead list and want the email, phone and location edit boxes to be immediately populated with the values from his NAB entry.
I'm banging my head on the wall over this because I'm sure there's an easy and obvious solution. Thanks.
Selecting a value from the typeahead should trigger any onChange event defined for the edit box. You can set the other fields by updating the data source directly from within that event:
var selectedName = currentDocument.getValue("contactName");
currentDocument.setValue("emailAddress", getEmail(selectedName));
currentDocument.setValue("phoneNumber", getPhone(selectedName));
currentDocument.setValue("location", getLocation(selectedName));
Naturally, the above example assumes those are your field names, and that you have the named functions defined elsewhere.

Resources