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

Question

Question

Filling a field with javascript no event triggered

asked on August 20, 2015

I populate a Field using the following code:

$(document).ready(function () {
 
  var re = new RegExp("(\\w+\\s\\w+\\W*\\w*)\\W");
 
  $('.jonaspm input').on('change', function() {
    var pm = $(this).val().match(re);
    $('.cleanpm input').val(pm[1]);
  });
 
});

 

I then want to use the result Field Value to Trigger a Stored Procedure and LookUp Rule. It seems neither will work based on populating the field with JavaScript. If I make changes in that same field then my Stored Procedure or LookUp Rule runs and populates a new field as I desire.

IE.

I use Field 1 'Jonas PM' value 'John Smith-NS'

I use the above code to populate Field 2 'Project Manager' from Field 1 with value 'John Smith'

I then want to populate Field 3 from Field 2 using Field 2 in a LookUp Rule or a LookUp Rule with Stored Procedure but Field 3 will not populate using the value of Field 2 passed to the LookUp Rule or LookUp Rule Stored Procedure when automatically filled by the above JavaScript.

However if I manually Type a value in Field 2 it works fine.

I assume this is because no Event is being triggered by the Field Value being populated by JavaScript.

Any ideas?

0 0

Answer

SELECTED ANSWER
replied on August 20, 2015

Figured it out had to add trigger change.

.trigger('change')

so

$('.cleanpm input').val(pm[1]).trigger('change');

2 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.