Delphi For PHP Forums       


Go Back   Delphi-PHP Forums > Programming > Javascript and Ajax
Forum Jump Register FAQ Members List Downloads Search Today's Posts Mark Forums Read

Javascript and Ajax Questions and information about working with Ajax and Javascript in Delphi for PHP.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 8th July 2009, 07:05
D4PHP Enthusiast
 
Join Date: Apr 2007
Location: Milano
Posts: 182
goitalia is on a distinguished road
Default Somebody can tell me why this ?

Hi,

attached a little form with
1) a panel
2) a button : buttonType = btNormal

in the on show of the panel i built a button and on click of this button i send a message with alert.
in the on js onclick of the first button i alert a message.
this is the script:
PHP Code:
class Unit12 extends Page
{
       public $Button1 = null;
       public $Panel1 = null;
       function Button1JSClick($sender, $params)

       {
       $mess  = _("A string from php");
       ?>
       //Add your javascript code here
       alert ("$mess");
       return false;

       <?php

       
}

       function 
Panel1Show($sender$params)
       {
       
$label _("Continua");
       
$mess  _("A string from php");
echo <<<CODE
<script type="text/javascript">
<!--
function Continua_inc_iscrizioneJSClick()
{
alert ("$mess");
}
</script>


 <button class="Button" type="button" name="Continua_inc_iscrizione" onclick="return Continua_inc_iscrizioneJSClick()" value="btn_continua">
                                              <span class="btn">
                                                  <span class="l"></span>
                                                  <span class="r"></span>
                                                  <span class="t">$label</span>
                                              </span>
                                        </button>
CODE;



       }

}
when i click on the button builted in the panel i got an alert screen with : the correct string,
when i do the same whit the button builted by delphi4php i got $mess.

This is very stupid thing but i am curious about why.
If somebody can spent 5 minut to explain i will be happy.
Paolo.
Attached Files
File Type: zip testjs.zip (1.0 KB, 0 views)
__________________
La guerre est un massacre entre gens qui ne se connaissent pas, et qu'il profite à des gens qui se connaissent mais qui ne se massacrent pas
Paul Valery
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 8th July 2009, 13:11
405hp's Avatar
Firebug Fanatic
 
Join Date: Dec 2007
Location: State of Confusion
Posts: 3,274
405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute
Default

I think it is pretty simple actually. In the first one you are outputting js but you are writing in php. (You escaped from php and are writing direct to the browser)

To do what you want to do change
PHP Code:
       {
       $mess  = _("A string from php");
       ?>
       //Add your javascript code here
       alert ("$mess");
       return false;

       <?php
       
}
to
PHP Code:
       {
       
$mess  _("A string from php");

      echo
' alert ("$mess");';
      echo 
' return false;';
       } 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT +1. The time now is 03:06.




Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0 ©2009, Crawlability, Inc.
Copyright © 2004 - 2009, G&J Solutions Ltd. All Rights Reserved. terms of use