This topic is locked

How to position TEXT

4/2/2008 6:44:51 PM
PHPRunner General questions
J
jack knowles author

Hi Forum,


I've applied some logic to the Add Page: Before record added Event .....
if ($ordervalue >= '0') && ($ordervalue < '500')) {

return true;

} else {

return false;

}
I'd like to achieve the following: when the "($ordervalue >= '0') && ($ordervalue < '500'))" condition is met, i would like to display a message such as "BAND A" between the "blue Orders, Add new record bar" and the "company - add field"
Not sure how this is done.
Thank you in advance
JK

J
Jane 4/3/2008

Hi,
just save your message in the $_SESSION variable in your code and then use it in the custom event in any place you want.

if ($ordervalue >= '0') && ($ordervalue < '500')) {

$_SESSION["message"] = "BAND A";

return true;

} else {

return false;

}


To add custom event select Insert PHP code snippet option on the Visual Editor tab.

Here is a sample code:

echo $_SESSION["message"];

$_SESSION["message"] = "";

J
jack knowles author 4/3/2008

Hi Jane,
Thanks you for the reply.
I've applied the code to a slightly different condition as below:
if ($ordervalue >= '0') && ($ordervalue < '500')) {

return true;

} else {

$_SESSION["message"] = "Order value must be be between 0-499";

return false;

}
However, i only get to see the session error message when the save button is clicked twice.
i.e. ordervalue = 300

1st click save button .... no display

2nd click save button .... see message
Cannot see why this is happening. Would kindly appreciate some help.
JK

J
Jane 4/3/2008

Hi,
it's difficult to tell you what's happening without seeing actual files.
Please publish your project on Demo Account and send to support@xlinesoft.com a URL to your pages along with instructions on reproducing this error.

I'll find what's wrong with your project inspecting it at Demo account site.

J
jack knowles author 4/3/2008

Hi Jane,
I've managed to solve the problem.
On Add Page: Before process, i've added the following line = "BAND A";
Add Page: Before record added, code reads

if ($ordervalue >= '0') && ($ordervalue < '500')) {

$_SESSION["message"] = "BAND A";

return true;

} else {

return false;

}
However, one last request please. How do i make the wording BAND A red in colour.
Thank You
JK

J
Jane 4/3/2008

Hi,
as a very simple solution try to assign your error message to $message variable:

...

$message = "Order value must be be between 0-499";

...

J
jack knowles author 4/3/2008

Hi Jane,
We must have been thinking upon the same lines.
How can i change the wording to colour RED.
Thanks
JK

J
Jane 4/3/2008

Hi,
add font tag to your message:

...

$message = "<font color=red>Order value must be be between 0-499</font>";

...

J
jack knowles author 4/3/2008

Jane,
Thank you for your help.
Great Product!!!
JK