DesiLogi Posted June 17, 2016 Report Share Posted June 17, 2016 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> Quote Link to comment Share on other sites More sharing options...
DesiLogi Posted June 17, 2016 Author Report Share Posted June 17, 2016 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; }); Quote Link to comment Share on other sites More sharing options...
MayMusic Posted June 20, 2016 Report Share Posted June 20, 2016 Thank for updating the post. here is a good reference for referring to Caspio elements on javascript JS Guide: Caspio Form Elements Quote Link to comment Share on other sites More sharing options...
ababcock Posted July 22, 2016 Report Share Posted July 22, 2016 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!! Quote Link to comment Share on other sites More sharing options...
MayMusic Posted July 25, 2016 Report Share Posted July 25, 2016 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> 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.