kpcollier Posted March 28 Report Share Posted March 28 When my submission form loads, I have a calculated value field that queries the datasource table and gets the most recently submitted value. I need to find a way to copy this value into my Text Area field. The Text Area field has the Advanced Text Editor enabled. Here is one of my attempts to get this to work. I get no errors, but the value does not show up in the Text Area editor. cbParamVirtual1 is the calculated value and cke_InsertRecordBulletin is what I think is the Text Area element I need to add the value to (I say think because with the editor enabled, there are a ton of elements related to this text area field). Any help is appreciated! document.addEventListener('DataPageReady', function (event) { document.querySelector('[id^="cbParamVirtual1"]').addEventListener("change", myFunction); function myFunction(event) { let calcField = event.target.value; document.getElementById("cke_InsertRecordBulletin").value= calcField.toLocaleString(); document.removeEventListener('DataPageReady', myFunction); } }); Quote Link to comment Share on other sites More sharing options...
cheonsa Posted March 28 Report Share Posted March 28 Hi @kpcollier, I found this post that is similar to your question. I just replaced EditRecord with InsertRecord, and used the correct field names. Here's the updated script. <script> document.addEventListener('DataPageReady', function (event) { document.querySelector('[name="cbParamVirtual1"]').addEventListener("change", myFunction); function myFunction(event) { let calcField = event.target.value; document.querySelector('#InsertRecordBulletin').value= calcField.toLocaleString(); document.removeEventListener('DataPageReady', myFunction); } }); </script> Quote Link to comment Share on other sites More sharing options...
kpcollier Posted March 28 Author Report Share Posted March 28 @cheonsa, that's actually where I got the script I tried and listed above. I cannot get it to work. No errors, but the text area editor is still blank on load. Quote Link to comment Share on other sites More sharing options...
Volomeister Posted March 29 Report Share Posted March 29 Hi @kpcollier The code must be modified. Try the following version: <script> document.addEventListener('DataPageReady', function (event) { document.querySelector('[name="cbParamVirtual1"]').addEventListener("change", myFunction); function myFunction(event) { let calcField = event.target.value; document.querySelector('#InsertRecordBulletin').value= calcField.toLocaleString(); document.querySelector('#InsertRecordBulletin').nextElementSibling.querySelector('iframe').contentDocument.querySelector('body').innerHTML = calcField document.removeEventListener('DataPageReady', myFunction); } }); </script> kpcollier 1 Quote Link to comment Share on other sites More sharing options...
kpcollier Posted March 29 Author Report Share Posted March 29 @Volomeister, thanks a ton. This one worked. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.