I tried the “Programming with Servoy” topic, but no one responded after 2 weeks. So, maybe this is an issue with Servoy or new feature needed?
I need to know how I get putClientProperty(APP_UI_PROPERTY.TRUST_DATA_AS_HTML, true) to work for newHtmlArea(dataprovider, x, y, width, height): JSField?
I’m trying to get MindFire Solution’s Auto Logout extension to work in Servoy 2020.03.
The pop-up and javascript works with application.putClientProperty(APP_UI_PROPERTY.TRUST_DATA_AS_HTML, true), but I don’t want this for the whole application. Just for this “newHtmlArea”.
In the scope autologout.js I’m trying this, but it doesn’t work (TypeError: Cannot find function putClientProperty in object):
frm.newVariable('var_progressbar', JSVariable.TEXT);
var htmlarea = frm.newHtmlArea('var_progressbar', 10, 70, AUTO_LOGOUT_CUSTOM_PROPERTIES.WIDTH - 20, 130);
htmlarea.editable = false;
htmlarea.scrollbars = SM_SCROLLBAR.HORIZONTAL_SCROLLBAR_NEVER|SM_SCROLLBAR.VERTICAL_SCROLLBAR_NEVER;
htmlarea.transparent = true;
htmlarea.styleClass = 'html';
htmlarea.name = 'logoutHtmlArea';
htmlarea.putClientProperty(APP_UI_PROPERTY.TRUST_DATA_AS_HTML, true);
Thanks,
Not sure I understand what you are trying to do. What is “MindFire’s Auto Logout solution”? What are you trying to accomplish?
Your code snippet shows some manipulation of a form’s “blueprint” via the solutionModel. putClientProperty is a runtime method, not design time. So to put a client property on that element at runtime, you finish creating/modifying your form and the you could do something like
var runtimeForm = forms[frm.name] //get the runtime instance of that frm
var runtimeHtmlArea = runtimeForm.elements[htmlarea.name] //get the runtime html area element
runtimeHtmlArea.putClientProperty(APP_UI_PROPERTY.TRUST_DATA_AS_HTML, true);
But maybe you can elaborate why you want to create/modify your form via code in the first place?
Thanks Patrick, your code snippet worked! ![Very Happy :D]()
But to answer your questions:
Not sure I understand what you are trying to do. What is “MindFire’s Auto Logout solution”? What are you trying to accomplish?
MindFire has an example that produces a pop-up that is created on the fly in javascript after a timer goes off (idle time = timer value). However, this was done before Servoy changed and added a new APP property (APP_UI_PROPERTY.TRUST_DATA_AS_HTML, default=false) introduced in 8.1.1. This stopped javascript from running by default. So, I’m trying to get this auto logout solution to work in latest version of Servoy, without having to set APP_UI_PROPERTY.TRUST_DATA_AS_HTML=true for the whole application.
Thanks again.