Salesforce - Populate text are from drop down selection - salesforce

I have a picklist with three values and a text area that has three values as well, but I would like to correlate one value from the picklist with one value of the text area. Any thoughts as on how I can do this?

If creating a visualforce page is an option, you can do this with a controller extension, or a custom controller. For example, you could override the save() method and have your new save code populate the text for you-- simply create a map of dropdown values to text area content and set the text as desired. It should also be possible to do this without saving by using some of the visualforce built in AJAX hooks: look at the onchange attribute. (Note that last I checked the onchange did not fire properly for lookups, but it may work for dropdowns)
Have a look at the visualforce documentation here: http://www.salesforce.com/us/developer/docs/pages/index.htm

Related

Grafana custom editor for every query/series

I was wondering if it is possible to write a custom editor (StandardEditorProps) that displays multiple input fields dynamically for every query (every series in the dataFrame).
I would need the same form (labels, bunch of select and text input fields) repeated for every query (I need to get the field names of the query resultset).
These values will be then used to render the custom panel plugin.
If I return, in StandardEditorProps, the entire form, then onChange every select input field is updated with the same value and I cant get the value of every input field in the custom panel plugin as only one customEditor is added in the module.tsx.
On the other hand, If I define multiple custom (and others non custom) editors in module.tsx I can get the values in the panel plugin but I cant make N such forms dynamically.
Hope that makes sense.
Does anyone have any suggestions or ideas how achieve that?

How to dynamically remove field in Drupal 7 custom form using AJAX

Based on the "Add-more button (with graceful degradation)" example available in Drupal examples module I have created a form that can add fields dynamically using AJAX, and now i want to add a separate Remove button to each of those fields so that i can remove individual fields (not just the last field).
Decrementing the number of fields and rebuilding the form only removes the last field in the form.
What's the Drupal way of doing this? and what would be the best approach to achieve my requirement?
So each field gets a remove button next to it? In that case, the button simply needs to target the wrapper for that field (surround the field in an easily identifiable div, and set the ajax target for the button to the same). Hint: the button should also be contained within that wrapper so it also disappears when clicked.

<select> tag brings up dynamically a different set of input fields depending on selection in AngularJS

Im trying to create a form, first element should be a tag with a few options and each of them will dynamically bring up a different set of forms depending on what the user chooses. The idea is within the select tag there will be different categories like cars, properties etc.. first user only sees that and when chose, it will bring up a set of input fields that required for that category.
Anyone got an idea what would be the best way to do it in angular?
Using the ui.router module, you can populate a DOM element (ui-view) with an HTML template file. On selection of the dropdown, you're telling angular to go to a different "state".
Check out the following plunkr I made: http://plnkr.co/edit/jnKQOvkE4nJinEQ5zhr6?p=preview

best way to dynamically populate dropdown options in jqgrid advanced searching

What's the best way to dynamically populate dropdown options in jqgrid advanced searching?
1) The first way: use "dataUrl" option of "searchoptions"
Disadvantage: when user add new criteria, and choose the attribute, dataUrl was posted to the server, when user add the same criteria again, dataUrl was posted to the server again, and with twice. very strange.
Advantage: the values user selected previously was there and not cleared.
2) The second way: use "dataInit" option of "searchoptions"
Disadvantage: the values user selected previously was cleared when adding new criteria(can not accepted, because it is not user-friendly, please refer url: the selected value was cleared in dropdown after add new criteria in jqgrid advanced searching)
Advantage: data was loaded into page when the page refreshed and only once.
3) the third way, use "value" option of "searchoptions"
but it's not dynamically, just hard-coded in page.
Could any one share the best practice about the issues. thanks.
I start with the second option. I suppose that you use dataInit in the wrong way. The goal of dataInit to initialize the control, like convert <select> to select2 or set jQuery UI Autocomplete or jQuery UI Datepicker on text input element. One should not fill the control with values. The select control is already created and filled before calling of dataInit.
If one use the first option, one can set HTTP cache header to prevent multiple request to dataUrl.
About the last option: one can set searchoptions.value dynamically inside of beforeProcessing for example. See the answer, this one and this one.

Select2 AngularJS - How do i dynamically add a tag item?

I have a select2 input box the defined like this:
<input id="searchbox" ui-select2="autoCompleteSearch" ng-model="searchedLeafs" style="width:80%;height:36px;" class="searchbox"/>
Basically, while the user can type text into the input box (and select from the suggested autocomplete list), i would also would like to enable the user to click on an angular-based button (on the same scope) which "inject" a tag into this input box (instead of the user typing it).
Does anyone can tell me how you can do it property in angularjs? i know how to do it in the old plain select2, but coulnd't find how can you manually/dynamically add items (key/value) to the list of tags.
if you want to get a simple example, lets say that instead of you typing the tags that you want to associate with stackoverflow question, you would simply click on a link/button which would add it to the list of tags yourself.
Thx
Simply push a new object into the ng-model's array and assuming it's duck-typed to the rest of the objects it should show up fine.

Resources