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

Discussion

Discussion

Replace method is not working after form is submitted

posted on February 23, 2017

I have a form that retrieves data from a stored procedure and I would like to manipulate the data to remove the ending '||' characters when displaying the data.  I have a function that is called onloadlookupfinished but this does not apply when the form is submitted and displayed.  I need the form to display as it does onloadlookupfinished.  Below is the code I have that is working, but need help with a script that will apply the change when the form is submitted.  

$(document).on('onloadlookupfinished', function () {
  $('#loadingscreen').hide();
  var comment = $('.comm textarea').val();
  comment = comment.replace(/[||]+$/, '');
  //alert(comment);
  $('.comm textarea').val(comment);
});

Display Correctly on load:

Default value is set to 'test || test ||' and I only want to remove the end set of '||'

After submission:

Thanks,

Nate

0 0
replied on February 24, 2017

If the comment field set to read-only on the form from layout page? If it is set to read-only, even if you modify the data via JavaScript, but the value submitted is actually the one from the stored procedure as the lookup will be performed in the backend after submit.

I would suggest you to set the field to not read-only in the layout page, then use JavaScript to set it to read-only and apply the changes you already made,  so that the value submitted will be the value after modification with JavaScript as the field itself doesn't have read-only properties.

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

Sign in to reply to this post.