Append to the short description via client script

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2012 11:06 AM
I would like to append text to the current "short description" of a task from a client script. Below is what I have:
function onSubmit() {
var action = g_form.getActionName();
var task_state = g_form.getValue('state');
var task_sd = g_form.getValue('short_description');
if ((action == 'close_task') && (task_sd=='PC or Laptop Replacement')) {
var return_answer = confirm('Click OK If This User Received MS Office 2010. Otherwise Click "Cancel".');
if (return_answer==true){
//what do we do here?
//gsftSubmit(gel('close_task'));
g_form.setValue('short_description', "'task_sd - Office Installed'");
When I use this I get the literal value of the last line and not the value of the sd_task variable. I've tried a few different combinations of parentheses and "+"'s, but I can't get it to use the current short description plus my new text of " - Office Installed". What am I doing wrong?
Jason
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2012 11:26 AM
Did you try :
g_form.setValue('short_description', task_sd +' - Office Installed');
ND

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2012 11:27 AM
This should work better
function onSubmit() {
var action = g_form.getActionName(),
task_state = g_form.getValue('state'),
task_sd = g_form.getValue('short_description'),
new_shortdesc;
if ((action == 'close_task') && (task_sd=='PC or Laptop Replacement')) {
var return_answer = confirm('Click OK If This User Received MS Office 2010. Otherwise Click "Cancel".');
if (return_answer){
//what do we do here?
//gsftSubmit(gel('close_task'));
new_shortdesc = task_sd + " - Office Installed";
g_form.setValue('short_description', new_shortdesc);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2012 11:45 AM
Thank you both! That got it.
Jason