Jump to content
Sign in to follow this  
Heineperson

Concatenate autocompleted virtual fields with existing non virtual field

Recommended Posts

Hi! 

This is my first question on this forum, so I apologize if this question is not in the scope of the board

I followed this thread to concatenate values from four virtual fields onto an existing field on a details page upon "update". I added the code below to the footer of my details page, and it worked when my virtual fields were text fields. However, this code did no longer worked when I changed my virtual fields to autocomplete fields. Is there another step I need to convert the autocomplete to text?

<SCRIPT LANGUAGE="JavaScript">
function concatenate()
{
var x0 = document.getElementById("EditRecordOtherCollectors").value;
var x1 = document.getElementById("cbParamVirtual2").value;
var x2 = document.getElementById("cbParamVirtual3").value;
var x3 = document.getElementById("cbParamVirtual4").value;
var x4 = document.getElementById("cbParamVirtual5").value;

document.getElementById("EditRecordOtherCollectors").value = x0+" "+x1+" "+x2+" "+x3+" "+x4;
}


document.getElementById("caspioform").onsubmit=concatenate;
</SCRIPT>

 

Thanks!

 

Share this post


Link to post
Share on other sites
On 3/3/2017 at 2:51 PM, Heineperson said:

Hi! 

This is my first question on this forum, so I apologize if this question is not in the scope of the board

I followed this thread to concatenate values from four virtual fields onto an existing field on a details page upon "update". I added the code below to the footer of my details page, and it worked when my virtual fields were text fields. However, this code did no longer worked when I changed my virtual fields to autocomplete fields. Is there another step I need to convert the autocomplete to text?


<SCRIPT LANGUAGE="JavaScript">
function concatenate()
{
var x0 = document.getElementById("EditRecordOtherCollectors").value;
var x1 = document.getElementById("cbParamVirtual2").value;
var x2 = document.getElementById("cbParamVirtual3").value;
var x3 = document.getElementById("cbParamVirtual4").value;
var x4 = document.getElementById("cbParamVirtual5").value;

document.getElementById("EditRecordOtherCollectors").value = x0+" "+x1+" "+x2+" "+x3+" "+x4;
}


document.getElementById("caspioform").onsubmit=concatenate;
</SCRIPT>

 

Thanks!

 

Hi, welcome to forum :)

I edited your script a little bit, we need to use another syntax for autocomplete fields.

 

<SCRIPT LANGUAGE="JavaScript">
function concatenate()
{
var x0 = document.getElementById("EditRecordOtherCollectors").value;
var x1 = document.getElementsByName("cbParamVirtual2")[0].value;
var x2 = document.getElementsByName("cbParamVirtual3")[0].value;
var x3 = document.getElementsByName("cbParamVirtual4")[0].value;
var x4 = document.getElementsByName("cbParamVirtual5")[0].value;

document.getElementById("EditRecordOtherCollectors").value = x0+" "+x1+" "+x2+" "+x3+" "+x4;
}


document.getElementById("caspioform").onsubmit=concatenate;
</SCRIPT>

 

 

Share this post


Link to post
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...
Sign in to follow this  

×
×
  • Create New...