Welcome to the nuBuilder Forums!
Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.
Questions related to using nuBuilder Forte.
toms
Posts: 785 Joined: Sun Oct 14, 2018 11:25 am
Unread post
by toms » Sun Feb 18, 2018 11:44 am
Hi,
I'd like to display a message with PHP. I thought I could call
in the AS event, but the passed parameter o is empty. What am I doing wrong?
nuMessage.PNG
You do not have the required permissions to view the files attached to this post.
toms
Posts: 785 Joined: Sun Oct 14, 2018 11:25 am
Unread post
by toms » Mon Feb 19, 2018 12:56 am
Steven,
Actually I just want to show an info message in PHP, nuDisplayError() is not suitable since it will then not save the record.
I was wondering why I could call the js function nuMessage() from php (but, as already mentioned, no parameter is passed).
admin
Site Admin
Posts: 2829 Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 30 times
Unread post
by admin » Mon Feb 19, 2018 10:37 pm
toms,
If nuDisplayError() is used in After Save or After Delete, a message will now appear.
Please see if this now works for you.
(You'll need the latest from Github.)
Steven
toms
Posts: 785 Joined: Sun Oct 14, 2018 11:25 am
Unread post
by toms » Tue Feb 20, 2018 6:21 am
Steven,
It works all fine. I just think that the function's name is a bit misleading since, in this case, it shows only an ordinary message and not an error message.
Just as an idea for the (far) future : A function nuDisplayMessage() could be created with different types of messages.
Something like that:
msg3.png
message_types.jpg
You do not have the required permissions to view the files attached to this post.
admin
Site Admin
Posts: 2829 Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 30 times
Unread post
by admin » Tue Feb 20, 2018 5:53 pm
toms,
Hopefully, nuDisplayError() isn't so confusing to the developer if they read the wiki.
http://wiki.nubuilder.net/nubuilderfort ... splayError - I updated it yesterday.
If you mean a message might be misleading to a User, then that could be considered the developer's fault.
But the string passed to nuDisplayError can be HTML.
So you could do something like this...
Code: Select all
nuMessage(["<img id='nulogo' width='40px' src='graphics/numessage.png' style='position:absolute;left:2px;top:2px'>","That is now finished!"])
numessage.png and
nuerror.png are available in nuBuilder Forte's graphics directory.
Steven
toms
Posts: 785 Joined: Sun Oct 14, 2018 11:25 am
Unread post
by toms » Wed Feb 21, 2018 5:04 pm
admin wrote: opefully, nuDisplayError() isn't so confusing to the developer if they read the wiki.
I mean if nuDisplayError() is not always intended to display an
error message, then the name is misleading. But that's a matter of opinion.
While nuMessage() can be used in Javascript,
I just want to show an info message in PHP
Is there an easy way to call nuMessage() from PHP code? I've tried using echo but without success.
admin
Site Admin
Posts: 2829 Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 30 times
Unread post
by admin » Wed Feb 21, 2018 7:07 pm
toms,
I don't understand your question.
Is there an easy way to call nuMessage() from PHP code?
nuMessage() is a Javacript function.
Steven
toms
Posts: 785 Joined: Sun Oct 14, 2018 11:25 am
Unread post
by toms » Thu Feb 22, 2018 7:10 am
My question was:
Is there an easy way to call nuMessage() from PHP code? I've tried using echo but without success.
A possible solution to use nuMessage() in PHP:
Code: Select all
$j = "nuMessage([\"<img id=\'nulogo\' width=\'40px\' src=\'graphics\/numessage.png\' style=\'position:absolute;left:2px;top:2px\'>\",\"That is now finished!\"])";
nuAddJavascript($j);
EDIT : The message is not showing up in AS (PHP)