Javascript question - custom HTML

Confluence User - 11 Nov, 2019

Greetings - I have javascript question, so excuse the lack of programming language.


I am monitoring for text field changes and it works fine with the following snippet line:

...
$('input[name="status_current"], input[name="status_new"]').change( function(){
....

The "input" above doesnt work with select box where you change the value based on the dropdown value.

is there a different method I can use?

thanks

Tony




javascript;field;calculation;customhtml

4


11 Nov, 2019
confluenceUser
confluenceUser

try to use below to get the value of the option selected

$('select').on('change', function() {
alert( this.value );
});



11 Nov, 2019
confluenceUser
confluenceUser

Hi, instead of $('input') you should try to use Javascript API#getField(fieldId).

12 Nov, 2019
confluenceUser
confluenceUser

Hi - thank you for your input. I tried both methods, but it wont fire... I would like to fire when the select box called "PONumber" changes value. in this example, I simply read the value of the iAmount and update "POImpact" accordingly.

<script>

$(getField("PONumber")).change( function(){
      var iAmount = Number.parseFloat(FormUtil.getValue("Invoice_Amount").replace(/[^0-9\.-]+/g,""));
      $('input[name="POImpact"]').val(iAmount);
});

$("PONumber").on('change', function() {
      var iAmount = Number.parseFloat(FormUtil.getValue("Invoice_Amount").replace(/[^0-9\.-]+/g,""));
      $('input[name="POImpact"]').val(iAmount);
});

</script>

12 Nov, 2019
confluenceUser
confluenceUser

It should be FormUtil.getField("PONumber") instead of just getField("PONumber")

RELATED QUESTIONS

Your answer


To answer a question you'll need an account.

Print