Watch, Follow, &
Connect with Us

Welcome, Guest
Guest Settings
Help

Thread: What i can write a java message in *.php module?



Permlink Replies: 6 - Last Post: May 31, 2014 2:45 PM Last Post By: Vladimir frolov
Vladimir frolov

Posts: 9
Registered: 8/24/12
What i can write a java message in *.php module?
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 30, 2014 5:18 PM
Hello!
function Button1Click($sender, $params)
{
...
$nc=count($conds);
if ($nconds==0) {
?>
//begin js
alert('hello');
//end
<?php
}
......
}
// this construction is not working
//where is an error ?
--
Vladimir Frolov
Antonio Estevez

Posts: 503
Registered: 4/12/00
Re: What i can write a java message in *.php module?
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 31, 2014 12:13 AM   in response to: Vladimir frolov in response to: Vladimir frolov
El 31/05/2014 2:18, Vladimir frolov escribió:
Hello!
function Button1Click($sender, $params)
{
...
$nc=count($conds);
if ($nconds==0) {
?>
//begin js
alert('hello');
//end
<?php
}
......
}
// this construction is not working
//where is an error ?
--
Vladimir Frolov

You must create a Javascript event not a PHP event.
PHP events are executed in the server.
Javascript events are executed in the client (browser)

Select the Javascript tab in the Object Inspector and double-click over
OnClick event:

     function Button1JSClick($sender, $params)
     {
         ?>
         //begin js
 
         //end
         <?php
     }


Note that the event function has "JS" in its name
Vladimir frolov

Posts: 9
Registered: 8/24/12
Re: What i can write a java message in *.php module?
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 31, 2014 8:34 AM   in response to: Antonio Estevez in response to: Antonio Estevez
Antonio Estevez wrote:
El 31/05/2014 2:18, Vladimir frolov escribió:
Hello!
function Button1Click($sender, $params)
{
...
$nc=count($conds);
if ($nconds==0) {
?>
//begin js
alert('hello');
//end
<?php
}
......
}
// this construction is not working
//where is an error ?
--
Vladimir Frolov

You must create a Javascript event not a PHP event.
PHP events are executed in the server.
Javascript events are executed in the client (browser)

Select the Javascript tab in the Object Inspector and double-click over
OnClick event:

     function Button1JSClick($sender, $params)
     {
         ?>
         //begin js
 
         //end
         <?php
     }


Note that the event function has "JS" in its name

--
Vladimir Frolov

Thank you. And how can I thus created from Java environment have access to a variable of any
of the php module, for example, $nconds?
Or to any component properties?
Antonio Estevez

Posts: 503
Registered: 4/12/00
Re: What i can write a java message in *.php module?
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 31, 2014 9:37 AM   in response to: Vladimir frolov in response to: Vladimir frolov
El 31/05/2014 17:34, Vladimir frolov escribió:

Thank you. And how can I thus created from Java environment have access to a variable of any
of the php module, for example, $nconds?
Or to any component properties?


     function Button1JSClick($sender, $params)
     {
         //$nconds= 5;
         ?>
         //begin js
 
         var nconds= <?php echo  $nconds; ?> ;
 
         alert("nconds= " + nconds);
 
         //end
         <?php
     }
Vladimir frolov

Posts: 9
Registered: 8/24/12
Re: What i can write a java message in *.php module?
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 31, 2014 9:59 AM   in response to: Antonio Estevez in response to: Antonio Estevez
Antonio Estevez wrote:
El 31/05/2014 17:34, Vladimir frolov escribió:

Thank you. And how can I thus created from Java environment have access to a variable of any
of the php module, for example, $nconds?
Or to any component properties?


     function Button1JSClick($sender, $params)
     {
         //$nconds= 5;
         ?>
         //begin js
 
         var nconds= <?php echo  $nconds; ?> ;
 
         alert("nconds= " + nconds);
 
         //end
         <?php
     }

Thank you very much. In other words, the value of the php- unit is transferred to the Java environment using the echo?
Do not tell me where I can read about it in more detail.
--
Vladimir Frolov

Antonio Estevez

Posts: 503
Registered: 4/12/00
Re: What i can write a java message in *.php module?
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 31, 2014 11:32 AM   in response to: Vladimir frolov in response to: Vladimir frolov
El 31/05/2014 18:59, Vladimir frolov escribió:
Antonio Estevez wrote:
El 31/05/2014 17:34, Vladimir frolov escribió:

Thank you. And how can I thus created from Java environment have access to a variable of any
of the php module, for example, $nconds?
Or to any component properties?


      function Button1JSClick($sender, $params)
      {
          //$nconds= 5;
          ?>
          //begin js
 
          var nconds= <?php echo  $nconds; ?> ;
 
          alert("nconds= " + nconds);
 
          //end
          <?php
      }

Thank you very much. In other words, the value of the php- unit is transferred to the Java environment using the echo?


Not exactly. PHP has not concept of Javascript (or any other script
language)

When the php code is executed, the server sends to de browser something
like this (if $ncods is equal to 5):

function Button1JSClick(event)
{
 
   var event = event || window.event;
   var params=null;
         //begin js
 
         var nconds= 5 ;
 
         alert("nconds= "+nconds);
 
         //end
 
}

Do not tell me where I can read about it in more detail.

http://www.php.net/manual/en/language.basic-syntax.phpmode.php

--
Vladimir Frolov

Edited by: Antonio Estevez on May 31, 2014 11:52 AM
Vladimir frolov

Posts: 9
Registered: 8/24/12
Re: What i can write a java message in *.php module?
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 31, 2014 2:45 PM   in response to: Antonio Estevez in response to: Antonio Estevez
Antonio Estevez wrote:
El 31/05/2014 18:59, Vladimir frolov escribió:
Antonio Estevez wrote:
El 31/05/2014 17:34, Vladimir frolov escribió:

Thank you. And how can I thus created from Java environment have access to a variable of any
of the php module, for example, $nconds?
Or to any component properties?


      function Button1JSClick($sender, $params)
      {
          //$nconds= 5;
          ?>
          //begin js
 
          var nconds= <?php echo  $nconds; ?> ;
 
          alert("nconds= " + nconds);
 
          //end
          <?php
      }

Thank you very much. In other words, the value of the php- unit is transferred to the Java environment using the echo?


Not exactly. PHP has not concept of Javascript (or any other script
language)

When the php code is executed, the server sends to de browser something
like this (if $ncods is equal to 5):

function Button1JSClick(event)
{
 
   var event = event || window.event;
   var params=null;
         //begin js
 
         var nconds= 5 ;
 
         alert("nconds= "+nconds);
 
         //end
 
}

Do not tell me where I can read about it in more detail.

http://www.php.net/manual/en/language.basic-syntax.phpmode.php

--
Vladimir Frolov

Edited by: Antonio Estevez on May 31, 2014 11:52 AM

--
Vladimir Frolov

My problem is as follows. I have button1, and for the treatment of depression, I chose normal. on click.

function Button1Click($sender, $params)
...
$nconds = count ($conds);
  if ($nconds = 0 ) {
   ?>
          //begin js
           var nconds= <?php echo  $nconds; ?> ;
          alert("nconds= " + nconds);
           //end
  <?php
 
  }
...
}
 


It turns out that I can not in this case give an alert message through alert.
So should I choose instead Event onClick the event onclickJS
{code}

function Button1ClickJS($sender, $params)
my code
$nconds = ...
....
if ($ncons = 0) {

?>
//begin js

alert ('You have not selected any conditions');
//end
<?php

my code

}

}

Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02