views:

30

answers:

1

Can i use ListBox control in MS CRM? I want to scroll the list item insid list. But in picklist It seems not possible. So i just want to add the Listbox control in dynamic CRM page .So can I ?

A: 

Yes, you can add document elements into the HTML using JavaScript. The rendered page in CRM is just HTML (with JavaScript, CSS, of course) so you can use the DOM to manipulate it in places like the onLoad event of the form.

To add an html element into a page, you would need to find the location of an existing page element then use document.createElement() to add a SELECT object into the DOM.

This blog post should get you started on adding and removing items from the list box:

http://timstall.dotnetdevelopersjournal.com/adding_and_removing_items_from_an_html_listbox.htm

Essentially, you're using JavaScript to create an element, then add items to that. Something like this:

var selector = document.createElement('select');
selector.id = 'selTest1';
selector.name = 'selTest1';
cell.appendChild(selector);

var option = document.createElement('option');
option.value = '0';
option.appendChild(document.createTextNode('Test Item 1'));
selector.appendChild(option);

option = document.createElement('option');
option.value = '1';
option.appendChild(document.createTextNode('Test Item 2'));
selector.appendChild(option);

You would then need to manually save the option selected by the user in the onSave, and load that value in the onLoad for a record update.

Overall, it sounds like quite a complex solution for your problem. Perhaps you could explain more about what you say:

"I want to scroll the list item insid list. But in picklist It seems not possible."

There may well be a solution to this problem we can help with. Do you essentially want to scroll the picklist to a value in the onLoad?

HTH.

ABC123