Page 4 of 5

Re: Add text style

PostPosted: Wed Feb 13, 2019 8:49 pm
by Janusz

Re: Add text style

PostPosted: Wed Feb 13, 2019 9:51 pm
by nac
Thanks Janusz,

It looks like the Trumbowyg editor is not getting the contents from the textarea object when the form is loaded. This then affects the saving.
It is difficult to investigate this with fragments of code; ideally one would look at the application interactively. Perhaps, as a start, could you paste the entire contents of the form's Custom Code>JavaScript in your reply (use the code tags) ?

BTW, I would not put this type of field in the Browse form unless needed for searching - it would not render as formatted text.

Neil

Re: Add text style

PostPosted: Wed Feb 13, 2019 10:18 pm
by Janusz
Neil,
Thank you very much for you involvement - I appreciate it very much.

In fact the server I am testing it now - is temporary one with no sensitive data on it (just one test table) so I can share the access.

Would it be possible for you to open the following and have a look?

Re: Add text style

PostPosted: Wed Feb 13, 2019 10:29 pm
by nac
Janusz,

Sure - I will have a look and see what I can do.
I have noted the credentials. If you wish, you can delete/edit them in the previous post. (Always best to be cautious about these things.)

Neil

Re: Add text style

PostPosted: Wed Feb 13, 2019 10:33 pm
by Janusz
Thanks,
and just updated the previous post.

Janusz

Re: Add text style

PostPosted: Wed Feb 13, 2019 10:41 pm
by nac
Janusz,

It is fixed. There was a name clash and so I changed the ID of the HTML object from "tre-field1" to 'field1_tre'. The div id="tre-field1" remains the same as before .

Neil

Re: Add text style

PostPosted: Wed Feb 13, 2019 11:02 pm
by nac
As a follow-up, the efficiency of the save operation can be improved by skipping the objects which have not been edited. Here is the modified function.

Code: Select all
function nuBeforeSave() {
var hcont;
var ocont;
treField.forEach(function(element) {
    hcont = $("#"+"tre-"+ element).trumbowyg('html');
    ocont = $("#"+element).val();
    if (hcont !== ocont) {
       $("#"+element).val(hcont).change();
    }   
  });   
return true;
}

N

Re: Add text style

PostPosted: Wed Feb 13, 2019 11:25 pm
by Janusz
Neil,
Yeah it's working !!! :-)

Really Thank you very very much for your involvement and help.

Janusz

Re: Add text style

PostPosted: Wed Feb 13, 2019 11:28 pm
by nac
Zapraszamy!

Re: Add text style

PostPosted: Wed Feb 13, 2019 11:42 pm
by Janusz
Dziękuję Bardzo - i zapraszam na piwo jak będziesz w Krakowie.

Janusz