Refresh HTML Object

Questions related to customising nuBuilder Forte with Javascript or PHP.

Refresh HTML Object

Postby ernesttan1976 » Wed Jan 06, 2021 6:44 pm

Hi all,

I have a HTML object that I want to refresh with a new hyperlink.
I am using nuGetBreadcrumb(0), but this is too slow as it reloads the whole thing.
Is there another way I can reload only that HTML object?
Thanks.

Ernest
ernesttan1976
 
Posts: 41
Joined: Sat May 16, 2020 5:38 pm

Re: Refresh HTML Object

Postby ernesttan1976 » Wed Jan 06, 2021 6:47 pm

Like this.
I choose from the dropdown. Cookie is updated inside the HTML link. Call nuGetBreadcrumb.
Takes 20 seconds.
Attachments
HTML Object.jpg
HTML Object.jpg (134.54 KiB) Viewed 68 times
ernesttan1976
 
Posts: 41
Joined: Sat May 16, 2020 5:38 pm

Re: Refresh HTML Object

Postby kev1n » Wed Jan 06, 2021 7:32 pm

I your URL looks like this:

Code: Select all
<a href="https://www.nubuilder.com" id="nuhttp">nuBuilder</a>



you can update it like this:

Code: Select all
$("#nuhttp").attr("href", "your_new_url_here");
If you like nuBuilder, please leave a review on SourceForge

nuBuilder Code Library (85)
Installation Guides
Updating nuBuilder

Join Discord to talk about nuBuilder!
kev1n
nuBuilder Team
 
Posts: 1193
Joined: Mon Oct 15, 2018 2:13 am

Re: Refresh HTML Object

Postby ernesttan1976 » Fri Jan 08, 2021 1:12 pm

Hi Kevin,

Thanks for your answer.

Actually I refer to the HTML Object in the Nubuilder form. It is not a "A HREF" link.
I choose an item from the "Select Object"
Onclick event refreshes this "HTML Object" by calling nuGetBreadCrumb().

This nuGetBreadcrumb loads the whole page and takes too long.
I was wondering if there is anoher way to just refresh the HTML Object.

Many thanks for your help! :)
Attachments
HTML Object.jpg
HTML Object.jpg (117.21 KiB) Viewed 58 times
Select Object.jpg
Select Object.jpg (147.88 KiB) Viewed 58 times
ernesttan1976
 
Posts: 41
Joined: Sat May 16, 2020 5:38 pm

Re: Refresh HTML Object

Postby kev1n » Fri Jan 08, 2021 2:56 pm

If I understand correctly, this would have the same effect:
1. Refresh the select object
2. Refresh the iframe src
If you like nuBuilder, please leave a review on SourceForge

nuBuilder Code Library (85)
Installation Guides
Updating nuBuilder

Join Discord to talk about nuBuilder!
kev1n
nuBuilder Team
 
Posts: 1193
Joined: Mon Oct 15, 2018 2:13 am

Re: Refresh HTML Object

Postby ernesttan1976 » Sat Jan 09, 2021 11:28 am

function refreshiframe(id){

var r = JSON.parse(JSON.stringify(nuSERVERRESPONSE));
var o = -1;

for(var i = 0 ; i < r.objects.length ; i++){
if(r.objects[i].id == id){
o = i;
}
}

if(o == -1){return;}
nuRUN(r, o, '', '', r);

}


Hi Kevin,

I inspected the page source, there is a function called refreshiframe, how do I call this function and get this iframe refreshed?

Ernest
ernesttan1976
 
Posts: 41
Joined: Sat May 16, 2020 5:38 pm

Re: Refresh HTML Object

Postby kev1n » Sat Jan 09, 2021 4:51 pm

refreshiframe() is not meant to be used for HTML objects, just for Run (Iframe) objects.

I added an onchange() event to the select object where the iframe src is changed:

select_change_iframe.gif
select_change_iframe.gif (783.78 KiB) Viewed 38 times


onchange event:

select_onchange.png
select_onchange.png (10.57 KiB) Viewed 38 times


Code: Select all
$('#html_GoogleForm').find('#iframe_google').attr('src',  $(this).val());



Give your iframe an id:
Code: Select all
<iframe id='iframe_google'
If you like nuBuilder, please leave a review on SourceForge

nuBuilder Code Library (85)
Installation Guides
Updating nuBuilder

Join Discord to talk about nuBuilder!
kev1n
nuBuilder Team
 
Posts: 1193
Joined: Mon Oct 15, 2018 2:13 am

Re: Refresh HTML Object

Postby ernesttan1976 » Mon Jan 11, 2021 10:22 am

Thank you very much Kevin, cheers!
ernesttan1976
 
Posts: 41
Joined: Sat May 16, 2020 5:38 pm

Re: Refresh HTML Object

Postby ernesttan1976 » Mon Jan 11, 2021 12:45 pm

success! Thanks so much Kevin!
ernesttan1976
 
Posts: 41
Joined: Sat May 16, 2020 5:38 pm

Re: Refresh HTML Object

Postby kev1n » Tue Jan 12, 2021 8:03 pm

You're welcome!
If you like nuBuilder, please leave a review on SourceForge

nuBuilder Code Library (85)
Installation Guides
Updating nuBuilder

Join Discord to talk about nuBuilder!
kev1n
nuBuilder Team
 
Posts: 1193
Joined: Mon Oct 15, 2018 2:13 am


Return to Custom Code