Jump to content

Can you assign a Virtual field's value with javascript

Recommended Posts

I am using the following code but doesn't seem to store the document.referrer string.  What am I doing wrong?

<script type="text/javascript">
document.addEventListener("DataPageReady", function (event) {
    document.getElementById('cbParamVirtual7').value = document.referrer;


Link to comment
Share on other sites

I have this script in the footer of a submission form.  (I have tried html as the very last field also but with no luck)

Virtual7 is set to render value as text.

My goal is that once Virtual7 receives the document.referrer string, it then gets passed as a parameter to a report datapage.  I want it to print on the report page, but get a blank result.  

Thanks for checking this out for me.  I've been stuck on this for a few days now.

Link to comment
Share on other sites

I appreciate your help.  It was set to display only.  (never would have guessed that!)

I have switched it to a text field but am still getting a blank on the report page. 

I pass it as a parameter to another virtual field in my report datapage (received onload).  I have that Virtual filed set to display only.  Does it need to be a text field as well? 

Link to comment
Share on other sites

You need to pass the "Virtual7" value as a "parameter" in your form's advance setting for that field- such as:

On exit:
Pass field value as parameter:

Then on your report page have that virtual field set as display only, but also have it set to receive the parameter:

Receive value or parameter:
External Parameters = [@Virtual7]

Link to comment
Share on other sites

I finally got this to work.  I was loading it as a referral from an active live domain, but apparently if the link opens in a new window it does not work.  As soon as I changed that it started displaying the domain.  Not critical, but if you know of a workaround, please share.

I can't thank you enough for guiding me toward this present  solution.  Bravo Sir!

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.

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.

  • Create New...