function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SATZSATZ 

how to remove the selected value from text area field using trigger

Hi,

 

 i create the custom object called ProgramTracker . this object contain tobeschduled and classschduled fields.


 Auto populate the values in Tobeschduled field  from Program  object. Tobeschduled field contain mulitple values. after i select the one value from Tobeschduled field to ClassScheduled field.
        
 we need to remove the selected value from Tobeschduled field .



Any help can be greatly Appreciated.

 

Thanks

SATZ

MandyKoolMandyKool

Hi,

 

It wont be possible to solve this issue using a trigger. What I would suggest is to place a button on your VF Page (on Program Tracker object) which will say "Schedule a Class". Once user clicks on the button; get the data from your text area (may be you can plan to split the strings using a comma or some other special character) and display it in a picklist (apex:SelectList and apex:SelectOption on your VF Page). once user selects it; push it to other text box.

 

While saving the records make sure that you remove the selected value from your text area (you will have selected value in your "selectList" string variable) then you can remove that part from your original field and save that field.

 

Hope this gives you some idea about how to achieve this!!

 

I tried my level best :)

Starz26Starz26

use the string.replace method to replace value that was selected that is found in the text area with ''.

 

String s = 'This is the year time';

String selectedVal = 'year';

s = s.replace(selectedVal,'');

 

result s = This is the time