Welcome to the nuBuilder Forums!

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

Refresh HTML Object

Questions related to customising nuBuilder Forte with JavaScript or PHP.
Post Reply
ernesttan1976
Posts: 51
Joined: Sat May 16, 2020 10:08 am

Refresh HTML Object

Unread post by ernesttan1976 »

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: 51
Joined: Sat May 16, 2020 10:08 am

Re: Refresh HTML Object

Unread post by ernesttan1976 »

Like this.
I choose from the dropdown. Cookie is updated inside the HTML link. Call nuGetBreadcrumb.
Takes 20 seconds.
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: Refresh HTML Object

Unread post by kev1n »

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");
ernesttan1976
Posts: 51
Joined: Sat May 16, 2020 10:08 am

Re: Refresh HTML Object

Unread post by ernesttan1976 »

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! :)
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: Refresh HTML Object

Unread post by kev1n »

If I understand correctly, this would have the same effect:
1. Refresh the select object
2. Refresh the iframe src
ernesttan1976
Posts: 51
Joined: Sat May 16, 2020 10:08 am

Re: Refresh HTML Object

Unread post by ernesttan1976 »

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.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
kev1n
nuBuilder Team
Posts: 4305
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 446 times
Contact:

Re: Refresh HTML Object

Unread post by kev1n »

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
onchange event:
select_onchange.png

Code: Select all

$('#html_GoogleForm').find('#iframe_google').attr('src',  $(this).val());

Give your iframe an id:

Code: Select all

<iframe id='iframe_google' 
You do not have the required permissions to view the files attached to this post.
ernesttan1976
Posts: 51
Joined: Sat May 16, 2020 10:08 am

Re: Refresh HTML Object

Unread post by ernesttan1976 »

Thank you very much Kevin, cheers!
ernesttan1976
Posts: 51
Joined: Sat May 16, 2020 10:08 am

Re: Refresh HTML Object

Unread post by ernesttan1976 »

success! Thanks so much Kevin!
kev1n
nuBuilder Team
Posts: 4305
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 446 times
Contact:

Re: Refresh HTML Object

Unread post by kev1n »

You're welcome!
Post Reply