The code below was given by CoopperBackPack and it's working really well and I was very grateful for his help. I'd like to go one step further by giving the user the option to make the image download or not by including a Virtual field (Type is Checked and the default is False) so that if the checkbox is ticked the Image will be downloaded and if it's unchecked the download will not happen. I've tried amending the footer code to execute the download if it's checked. The new line is in bold and underlined:
Footer:
<script>
document.addEventListener('DataPageReady', function (event) {
document.querySelector('input[id*="cbParamVirtual12"]').addEventListener("change", imageHandler);
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
RonAnderson
The code below was given by CoopperBackPack and it's working really well and I was very grateful for his help. I'd like to go one step further by giving the user the option to make the image download or not by including a Virtual field (Type is Checked and the default is False) so that if the checkbox is ticked the Image will be downloaded and if it's unchecked the download will not happen. I've tried amending the footer code to execute the download if it's checked. The new line is in bold and underlined:
Footer:
<script>
document.addEventListener('DataPageReady', function (event) {
document.querySelector('input[id*="cbParamVirtual12"]').addEventListener("change", imageHandler);
if(document.querySelector("input[name*="cbParamVirtual13"]").checked == true){
function imageHandler(event) {
let calcField = event.target.value;
document.querySelector("#item-img").src= calcField;
document.removeEventListener('DataPageReady', imageHandler);
}
});
</script>
I've also tried the line in the HTML block but I just can't get it to work. The HTML Block code is below
HTML Block:
<img id="item-img" width="680px" </img>
Could someone please help?
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.