Jump to content
DesiLogi

Copy Virtual Field value to field in Submission form with link

Recommended Posts

I'm trying to use an html link (in a Virtual Field set to Display Html) with id k_suppliermark to start a function to copy a virtual field's (cascading text) value to a stored field in a Submission form. I've tried a few ways based on things I've found in the forums but cannot get it to work. It should be simple, I would think...

The stored field is 'Markup' with is set to be a Cascading Text field (editable) and the virtual field is Virtual8.  The 'Markup' value can come from 3 places: the cascading parent table's value, or the Virtual8, or the user can type it in. I need each of these to work. Currently the Virtual8 is the only one that doesn't work. 

Can anyone see what I've gotten wrong here?

The below code is in an html block at the bottom of the submission form. 

<script>
$("#k_suppliermark").click(function CopyVirtual()

    {      document.getElementById('InsertRecordMarkup').value=document.getElementById("cbParamVirtual8").value

     })
</script>

Share this post


Link to post
Share on other sites

It looks like I got it to work. Because both Virtual and Saved fields are cascading text boxes I had to use names instead of ID. I need to test it further but I think it's the right code, if anyone else needs this:

 

$("#k_suppliermark").click(function(){
var MarkUp = document.getElementsByName('cbParamVirtual8')[0].value;
document.getElementsByName('InsertRecordMarkUp')[0].value = MarkUp;
});

Share this post


Link to post
Share on other sites

I am also trying to pass a Virtual Field to a saved field. I need to save Virtual3 (which is a cascading field) to a text area field, which is PCP_Diagnosis. It is on a submission form, and I'm having trouble figuring it out. I tried pulling from another submission page I had help creating, but it's not working. Here is what I have:

<script>
function changeVal() {
setTimeout(function(){
{
document.getElementById('InsertRecordPCP_Diagnosis').value = document.getElementsByName('cbParamVirtual3')[0].textContent;}
else
{
document.getElementById('InsertRecordPCP_Diagnosis').value ="";}

};

</script>

I would use the script you posted, but I'm not sure what to replace the k_suppliermark part with. Any help is very much appreciated!!

Share this post


Link to post
Share on other sites

Try this:

 <script>
function changeVal() {

document.getElementById('InsertRecordPCP_Diagnosis').value = document.getElementsByName('cbParamVirtual3')[0].value;
}
else
{
document.getElementById('InsertRecordPCP_Diagnosis').value ="";}

}
document.getElementById('caspioform').onsubmit = changeVal;

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

×
×
  • Create New...