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

Question

Question

Changing a field value from B to Both

asked on September 28, 2017

I have a field that is populated using a lookup from a db. The value in the db is B but I need it to show as 'Both'

This is what I have tried so far (that doesn't work)

$(document).ready(function(){
  $('.resides').on('change', 'input', changeInput);
  function changeInput () {
    if ($(this).text() == 'B') {
      $(this).text('input','Both');
    }
    else {
      $(this).text('input','none');
    }     
  }
});

 

0 0

Answer

SELECTED ANSWER
replied on September 28, 2017

Hey,

This would be much easier if you could make a view/stored procedure to do it but if you cant this code will be your best bet. On a side not I think the event i'm using here doesn't exist before 10.0 but i'm not sure.

$(document).ready(function() {
   $(document).on('lookupcomplete', function(event){
    	if ($('.resides input').val() == 'B') {
			$('.resides input').val('Both');
		}
		else {
			$('.resides input').val('None');
		} 
    });
});

 

0 0
replied on September 28, 2017

Hi Aaron,

That almost works. It seems to change 'Both' to 'None' though? I'm assuming that it changes the 'B' to 'Both' and then (because it matches the else statement) it changes it again to 'None'

I removed the "else" section and it works okay

0 0
replied on September 29, 2017

You are correct. That was an oversight. If you need the none just change it to an else if.

0 0

Replies

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

Sign in to reply to this post.