Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

howto use hash cookies in iframe on subform?

Questions related to using nuBuilder Forte.
Post Reply
hf2094
Posts: 22
Joined: Wed Jan 07, 2015 7:11 pm
Been thanked: 2 times

howto use hash cookies in iframe on subform?

Unread post by hf2094 »

Hello,
I have an HTML- field (defining an iframe) within a Subform based on a table containing fields with URLS. How can I use these URL in the embedded HTML/iframe?.

Definition of the HTML/iframe within the subform:

<iframe
width="560"
height="315"
src="#BILD#"
frameborder="0" allowfullscreen>
</iframe>

Whereas #BILD# is a Hash cookie from the subform.

Thank you for your help.

Hf2094
kev1n
nuBuilder Team
Posts: 4305
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 446 times
Contact:

Re: howto use hash cookies in iframe on subform?

Unread post by kev1n »

Can you upload a screenshot showing the form and fields?
hf2094
Posts: 22
Joined: Wed Jan 07, 2015 7:11 pm
Been thanked: 2 times

Re: howto use hash cookies in iframe on subform?

Unread post by hf2094 »

Screen1 describes the edit form. On this form I use a subform (Screen2) with a HTML-Element, defined as Iframe. In this Iframe I want to display external graphic files, as defined in a separate table BildS:

CREATE TABLE `mineral_BildS` (
`idBildS` int(11) NOT NULL AUTO_INCREMENT,
`idStufe` int(11) NOT NULL,
`BildS` varchar(100) DEFAULT NULL,
PRIMARY KEY (`idBildS`),
KEY `fk_mineral_BildS_1_idx` (`idStufe`),
CONSTRAINT `fk_mineral_BildS_1` FOREIGN KEY (`idStufe`) REFERENCES `mineral_Stufe` (`idStufe`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;

The edit form is based on table mineral_Stufe and the subform on mineral_BildS.

Using the nuBuilder file storage for storing pictures is not feasible, we need access tio the picture files for a piwigo-picture gallery.

Hope my english is not too weird.

Yours Hf 2094
You do not have the required permissions to view the files attached to this post.
kev1n
nuBuilder Team
Posts: 4305
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 446 times
Contact:

Re: howto use hash cookies in iframe on subform?

Unread post by kev1n »

If you just have the hash cookie #BILD# in your html object you'll see that it doesn't get resolved. This means that you have to get to the value of that BILD field in another way, e.g. by using JavaScript and then change the src of the frame.

Code: Select all

<iframe
	id="iframebild"
	width="560"
	height="315"
	src=""
	frameborder="0" allowfullscreen>
</iframe>


<script>

$(function() {
 
   // testing: 
   // var imgURL = 'https://www.nubuilder.com/img/nubuilderfortelogo.png';
   var imgURL = $('#bild').val(); // replace #bild if the id is different
   $('#iframebild').attr( "src",imgURL);

});

</script>

hf2094
Posts: 22
Joined: Wed Jan 07, 2015 7:11 pm
Been thanked: 2 times

Re: howto use hash cookies in iframe on subform?

Unread post by hf2094 »

Finally I found a solution based on your description of how to deal with iframe-IDs. Combined with our discussion some weeks ago about buttons on subforms I made it.

Greetings Hf2094
Post Reply