Page 1 of 1

Headline or caption for browse window ?

Posted: Wed Nov 17, 2021 7:27 pm
by honza1965
Have a nice day,
I need to add a caption to each window. Is there an easy way to solve it?
Thank you for your ideas, Honz

Re: Headline or caption for browse window ?

Posted: Wed Nov 17, 2021 7:41 pm
by kev1n
Add this JavaScript in a form's custom code:

Code: Select all

function nuSetFormTitle(s, fs = 20){
   s = escape(s);
   $('#nuActionHolder').append("<span style='font-size:" + fs + "px; color:#54561d; vertical-align:middle;'>" + "&nbsp;".repeat(15) +  s + " </span>");
}

nuSetFormTitle('Hello nuBuilder ');

If you declare the above function nuSetFormTitle() under Setup -> Header, it can be used in any form.

Re: Headline or caption for browse window ?

Posted: Wed Nov 17, 2021 8:09 pm
by honza1965
Amazing! ! ! Thank you very much :-)

Re: Headline or caption for browse window ?

Posted: Wed May 04, 2022 2:41 am
by nathan
Hello ,
I am new to nubuilder ,javascript and php so please be patient !!!
I will surely have more questions. :?:
I have tried this code in custom code of my form but the result is not what I expected ???
Also if I open in popup the text will not appear ??
Thank you

Code: Select all

function nuSetFormTitle(s, fs = 20){
   s = escape(s);
   $('#nuActionHolder').append("<span style='font-size:" + fs + "px; color:#54561d; vertical-align:middle;'>" + "&nbsp;".repeat(15) +  s + " </span>");
}
nuSetFormTitle('Hello nuBuilder '); 
This is what I get.
Hello%20nuBuilder%20

Re: Headline or caption for browse window ?

Posted: Wed May 04, 2022 5:24 am
by miasoft
Try comment string :
//s=escape();

Re: Headline or caption for browse window ?

Posted: Wed May 04, 2022 7:36 am
by kev1n
The escape() function was missing:

Code: Select all

function escape(s) {
  var escaped = {
    '&': '&amp;',
    '<': '&lt;',
    '>': '&gt;',
    "'": '&#39;',
    '"': '&quot;'
  };
  return s.replace(/[&<>'"]/g, function (m) {
    return escaped[m];
  });
}

Re: Headline or caption for browse window ?

Posted: Wed May 04, 2022 3:37 pm
by nathan
Thanks Kevin and miasoft both methods worked !!!