Chrille Posted January 13, 2020 Report Share Posted January 13, 2020 Hi! I am trying to change the value of a field in a detailspage on update if another field is not empty. I have this working in a submission form with this code: <script type="text/javascript"> function function1() { var v3 = '<img src="http://image_url" alt="YES"'; var v2 = document.getElementById("InsertRecordKontaktad").value; if (v2 !="") { document.getElementById("InsertRecordRingt").value = v3; } } document.getElementById("caspioform").onsubmit=function1; I have tried the same code in the detailspage but it will not work. I have also tried this code: <script type="text/javascript"> document.addEventListener('BeforeFormSubmit', function (event) { var v3 = '<img src="http://image_url" alt="YES"'; var v2 = document.getElementById("InsertRecordKontaktad").value; if (v2 !="") { document.getElementById("InsertRecordRingt").value = v3; }}); </script> This code will also not work. Does anyone have a idea? Kind regards/ Christofer Quote Link to comment Share on other sites More sharing options...
Vitalikssssss Posted January 14, 2020 Report Share Posted January 14, 2020 Hi @Chrille, You should use "EditRecord" prefix on Details page in order to reference a field. So, you code should look like this: <script type="text/javascript"> document.addEventListener('BeforeFormSubmit', function (event) { var v3 = '<img src="http://image_url" alt="YES"'; var v2 = document.getElementById("EditRecordKontaktad").value; if (v2 !="") { document.getElementById("EditRecordRingt").value = v3; }}); </script> Hope this helps. Regards, vitalikssssss Chrille 1 Quote Link to comment Share on other sites More sharing options...
Chrille Posted January 14, 2020 Author Report Share Posted January 14, 2020 @Vitalikssssss That helped a lot, got it working now. Thanks! Regards, Christofer 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.