Jump to content

Javascript not passing parameters


Recommended Posts

Hi,

I am using a script in an html block to detect certain criteria and display something based on that criteria.  Here is my script:

<script>
var status = "[@field:Account_status]";
function invitepopup() {
    window.open("https://c3fot467.caspio.com/dp.asp?AppKey=34fe4000f38aceb2a5da4c74bea2&UserID=[@field:User_ID]", "Invite", "menubar=1,resizable=1,width=500,height=500");
}
if (status === "Yes") {
    document.write("Active");
}
else {
    document.write('<a href="#" onclick="invitepopup()" title="Click to invite again">Invited by [@field:OriginUserName]</a>');
}
</script>
 
The if/else works fine, it shows "Active" for all the active users and "Click to invite again" for all the invitees ... however the link doesn't send the parameter properly.  https://c3fot467.caspio.com/dp.asp?AppKey=34fe4000f38aceb2a5da4c74bea2&UserID=[@field:User_ID] is passed with the wrong User_ID.  It seems to be passing the ID of the last user in the table, rather than the ID of the row it is in - it's currently showing 3 invitees in my table and they all are being received by the popup with the same ID (last user in the table).
 
However if I just put this in as a plain (<a href="https://c3fot467.caspio.com/dp.asp?AppKey=34fe4000f38aceb2a5da4c74bea2&UserID=[@field:User_ID]" title="Click to invite again">Invited by [@field:OriginUserName]</a>), it works completely fine!  Is there something in the script which is removing or replacing the User ID?  I'm completely stumped!
 
Hope someone can help!

Many thanks

Nikki
Link to comment
Share on other sites

  • 4 months later...

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