You are viewing limited content. For full access, please sign in.

Question

Question

Trying to Remove the Server Name from a Field

asked on January 14 Show version history

I have two fields:

1.  managerUsername (populates as SERVER\gstdenis)
2.  managerUsernameVALUE (desire to have it show up as gstdenis)

When the manager changes, the issue is that #1 is populated through a lookup rule. It comes in formatted as SERVER\newmanager. I need to remove the word SERVER\ so I can populate #2 with just newmanager. I find it's giving me a hard time at var server = "SERVER\". What am I doing wrong in Line 6 below?

$(document).ready(function(){

//When the Manager's Username Changes, Update Manager's Username VALUE
  var username = $('.managerUsername input').val();
  var server = "SERVER\";
  var newValue = username - server;
    $('.managerUsername input').on('change', function(){
      $('.managerUsernameVALUE input').val(newValue);
    });

});  //close document.ready

 

0 0

Answer

SELECTED ANSWER
replied two days ago

If I could delete this question, I would. Went with a lookup table which works. The stuff I put about the "replace" wasn't needed.

0 0

Replies

replied on January 14 Show version history

So, I decided to use Workflow to initially set the managerUsernameVALUE ... now I need to set the value through Forms whenever the manager is changed. I've updated my request above for the "on change". FYI ... had no problem adding text to create a newValue,, but how do you remove text?

0 0
replied two days ago Show version history

OK, I managed to get it to work by removing Line 5 and replacing Line 6 (new Line 5) with a replace:

$(document).ready(function(){

//When the Manager's Username Changes, Update Manager's Username VALUE
  var username = $('.managerUsername input').val();
  var newValue = username.replace('SERVER','');
  $('.managerUsername input').on('change', function(){
      $('.managerUsernameVALUE input').val(newValue);
  });

});  //close document.ready

FYI, I also had to remove the backslash after SERVER. It still has the same result I'm looking for (backslash doesn't show up) so I'm good!

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.