Jump to content

Change the value of a field in a detailspage on update.


Recommended Posts

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 

Link to comment
Share on other sites

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

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.

Guest
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.

Loading...
×
×
  • Create New...