I have a DataPage that I am embedding in a Joomla article. I use Joomla ACLs, so I am not using Caspio's authentication. But I still want to get the user's Name and ID (from Joomla) to load into the Caspio database to track who created/updated the records.
I uses a PHP snippet of code to get the user's information and put it into a variable. This works because I can echo it to the screen.
I then want to pass the variable to the Caspio DataPage by modifying the embed code generated for the DataPage as follows:
As generated by Caspio:
<script type="text/javascript" src="https://c1abs817.caspio.com/dp/ec1d70004e69797b8ed24ca4ade4/emb"></script><div class="cxkg"><a href="https://c1abs817.caspio.com/dp/ec1d70004e69797b8ed24ca4ade4">Click here</a> to load this Caspio <a href="http://www.caspio.com" target="_blank" title="CloudDatabase">CloudDatabase</a></div><div id="cbec1d70004e69797b8ed24ca4ade4"><a href="https://www.caspio.com" target="_blank">CloudDatabase</a> by Caspio</div>
As modified by me:
<script type="text/javascript" src="https://c1abs817.caspio.com/dp/ec1d70004e69797b8ed24ca4ade4/emb?joomuser=<?php echo $username; ?>"></script><div class="cxkg"><a href="https://c1abs817.caspio.com/dp/ec1d70004e69797b8ed24ca4ade4?joomuser=<?php echo $username; ?>">Click here</a> to load this Caspio <a href="http://www.caspio.com" target="_blank" title="CloudDatabase">CloudDatabase</a></div><div id="cbec1d70004e69797b8ed24ca4ade4><a href="https://www.caspio.com" target="_blank">Cloud Database</a> by Caspio</div>
Notice that I have put my modification " ?joomuser=<?php echo $username; ?>" into the script in two places. Not really sure if it's needed in both places, but not knowing, I put it in both.
When I press the SUBMIT button on the DataPage, the record ( a transaction header record) is written to the database and then a details DataPage is loaded. The record is written as expected and the 2nd DataPage is presented, but when I check the record written, the user name from JOOMUSER is not recorded.
Here is a screenshot of how I have the field set up on the datapage:
Clearly, I am doing something wrong or missing a step. Any help would be greatly appreciated.
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.
Question
mgredmond
I have a DataPage that I am embedding in a Joomla article. I use Joomla ACLs, so I am not using Caspio's authentication. But I still want to get the user's Name and ID (from Joomla) to load into the Caspio database to track who created/updated the records.
I uses a PHP snippet of code to get the user's information and put it into a variable. This works because I can echo it to the screen.
I then want to pass the variable to the Caspio DataPage by modifying the embed code generated for the DataPage as follows:
As generated by Caspio:
As modified by me:
Notice that I have put my modification " ?joomuser=<?php echo $username; ?>" into the script in two places. Not really sure if it's needed in both places, but not knowing, I put it in both.
When I press the SUBMIT button on the DataPage, the record ( a transaction header record) is written to the database and then a details DataPage is loaded. The record is written as expected and the 2nd DataPage is presented, but when I check the record written, the user name from JOOMUSER is not recorded.
Here is a screenshot of how I have the field set up on the datapage:
Clearly, I am doing something wrong or missing a step. Any help would be greatly appreciated.
Link to comment
Share on other sites
1 answer to this question
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.