Jump to content

Setting a filed value to virtual field value using JavaScrip

Recommended Posts

Hello @MarkMayhrai,

If I got the inquiry correctly, you have a Virtual field and some data source field on the Submission form. 

When the value in the Virtual field was changed, the value in the source field should be changed too. 

If the data source field is set to the usual input field, please test this code. 

Paste it to the DataPage Footer section. Do not forget to disable the HTML editor on the Advanced tab before pasting the code.

Also, please double-check the field names and replace them if needed. 

document.addEventListener('DataPageReady', function (event) {
document.querySelector('input[id*="cbParamVirtual1"]').addEventListener("change", myFunction); 
      function myFunction(event) {
          let virtualField = event.target.value;
          document.querySelector('#InsertRecordField_name').value= virtualField; //replace Field_name with your local field name
          document.removeEventListener('DataPageReady', myFunction);


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...