On BlackBerry I want to display an "Add contact" dialog with some fields populated.
I supposed the following code would work:
BlackBerryContact contact = (BlackBerryContact) mContactList.createContact();
populateSomeFields (contact);
AddressBookArguments args = new AddressBookArguments(
AddressBookArguments.ARG_NEW, contact);
Invoke.invokeApplication(Invoke.APP_TYPE_ADDRESSBOOK, args);
but no way.
If I Invoke with ARG_NEW a completely EMPTY fields are displayed. If I Invoke with ARG_COMPOSE an IllegalArgumentException is thrown.
Is there any way I can display "Add contact" with some fields filled in?
Well, there is no way to do just I want. But there is a nice crutch: commit contact (i.e. add it to phonebook) and then call Invoke with ARG_VIEW.
After that, user can press "edit" or "delete" from the menu.
Related
I have have a list/table which is bound to a entitySet from OData Model V2. I have a add(+) button on screen on clicking that button a empty row(s) need to be appended to the list/table. After that if I enter any data that should be saved into the backend on clicking of save button.
This is possible using JSONModel, but I want to use the OData model .
Regards,
Suman Kumar
It does work with two way data binding.
You can do that using odataModel createEntry method.
The createEntry expects a parameter, the path to your entitySet that you want to create (It should be something like XXXXset). Imagine the following:
1 - User clicks an "Add" button that renders a dialog Window with some fields and two buttons (save and cancel) for him to add his brand new entity.
2 - On the "open event" before you open the dialog, you create a new entity with the createEntry method. Its return gives you a context that you can bind to the dialog.
that.contextCursoIniciativaEmpregadoASerCriada = that.getView().getModel().createEntry('/CursoIniciativaEmpregadoSet');
that.fragmentCriacaoDadosInicEmpregado.bindElement(that.contextCursoIniciativaEmpregadoASerCriada.sPath);
that.fragmentCriacaoDadosInicEmpregado.open();
3 - The dialog pops up with the bind in place.
4 - The user fills the dialog with the entities properties
5 - The user clicks on the save button and you submit your changes
I have an object with many record types, and I need to populate some fields on it whenever it is created.
For example, I have an object called "CustomObj" with a field called "CustomF" with these 2 Record Types "RecType1" and "RecType2".
On the creation of a new "CustomObj" I need to populate the field the "CustomF" by "Hello" when the record type is "RecType1"
and by "Bye" when the record type is "RecType2"
Can I do that using the URL Hacking or I have to create 1 visualforce page to select the record type then redirect to the standard page with the values to populate this field or there is another approach?
What is the best practice?
How can I know the RecordType selected from the url itself ?
Thank you.
You can do this by an Workflow Rule. Go to Setup->Create->Workflow & Approvals. Than u can choose your object on which u want to set up the workflows. Most of the part should be straightforward since all the steps are well documented.
So one rule would be like:
If Record Type == RecType1 than fill in Field XY with value ABC
I see.
This is also possible. Go to the object and than your field you want to fill in the value. Click on edit and use the formula editor.
You can use a rule like
IF( $RecordType.DeveloperName = 'RecType1', 'Value for this', '')
for the default value
Salesforce does not provide an option to override "continue" button on record type selection page. but you can override "new" button. So you can do the following
Override "New" button to move to a record type selection page, which
will be a custom vf page (use radio buttons, description etc.).
The submit button (u can name as "Continue", just to imitate) should redirect to the standard page of data entry. But the
URL will be custom made.
You can refer to this Blog (Saurabh's Salesforce Blog) - http://writeforce.blogspot.in/2012/12/prepopulating-fields-using-url-hacking.html - for the idea of how the URL hacking can be done as per your need. Here you need to identify the field id and use them in the URL to provide a value to be prepopulated.
For modal dialog from bean I followed this link:
Automatically show validation messages in p:dialog on validation failure
But at the same time I want to show data-table record also. If I used action event in the button, its showing only modal message, no data table records. In case of using string function in the button, it shows only record, not validation message. How to fix this one?
I have a solution with ASP.NET MVC3. I have a page where we can manage users (create/edit/remove). I have paging on this page.
When edit button is pressed, a dialog is showed where editing is possible.
When user click the save button, the dialog is hided and the list is refresh through ajax.
The problem occurred when user edit an item on page 2 or 3 or ... In this case, the page 1 is showed. The reason is that the current page information is not known in my action's controller. I would like to keep the currectly active page in my view.
Here is the solution I have but not quite satisfied with:
On my edit button I have the ActionLink below:
#Html.ActionLink("Editer", "Edit", new { userID = item.UserID }, new { userID = item.UserID, page = Model.PageNumber, #class = "btn small editUser" })
I inject the page number in my anchor link. Next the dialog is shown. Next user click save (submitting). The submit action is triggered and the page number is injected in the post parameters like this:
$('form', dialog).submit(function () {
$.post($(this).attr('action'), $(this).serialize() + '&page=2', function (data, status) {
$('#my-modal').modal('hide');
$("#userList").html(data);
})
});
As you can see I manually added '&page=2' for testing purpose. The action in my controller receive the posted data (edited item + page number) updated my repository then RedirectToAction("List", new {page = page}) refresh the list for the right page.
I don't like this solution. There must be a better way of doing, isn't?
Thanks in advance if someone can help me on this.
Wether you have a complete "Ajax grid", which you can refresh without refreshing page, or you have a "server side" grid, than you need to reload page, and your solution is fine.
Why not, instead of returning the whole grid, just update the row with the new data. I do this on my search/edit pages. When the user clicks a row, store that row index in javascript. Then after a successful edit, update the row with the values from the textboxes.
I have an action Create() on my BooksController, where I create a new Book class. Part of this create process is to add one or more Authors, where Author is a class.
Here's the way I envision this working:
When user clicks "Create a new book" they are returned the Create view.
User can click "Add Author" button at any time. "Add Author" posts and saves all data in session, then RedirectToAction("Search", "Author", new { returnController="Books" returnAction="AddAuthor" } (pseudo)
That will return an AuthorId to the AddAuthor Action, which gets the new Book class out of session, updates with author, and redirects back to Create()
My question - is this the best way to handle a 'return to' with MVC? What if I wanted to have the Author Search include an 'add new author' option? I'd want to return to one URL, that returned the ID to a second URL. seems really confusing, could use some help. thanks.
I suggest that u make your AddAuthor controller takes nullable id of the author.
So when u have null id, you can redirect to an action to create an author, that will later return an id of the author that was created and then add it to the book.
And when you do pass the id it will just add the author to the specified book.