login form

31 views
Skip to first unread message

Ba9

unread,
Feb 24, 2009, 4:50:17 AM2/24/09
to PHP-Ext
Hello,
I use in my web application the complex (Border,Accordion,tab ) and I
want to create a login form in the east region but at this moment I
can't fetch the value of the user and password with Post method then
this my code :

<?php
// East Region
$east = new PhpExt_Panel();
$east->setTitle(utf8_encode("Menu"))
->setCollapsible(true)
->setWidth(200);

//
***********************SimpleForm**************************************************************************
$simple = new PhpExt_Form_FormPanel();
$simple->setStandardSubmit(true)
->setLabelWidth(75)
->setUrl("login.php")
->setFrame(true)
->setBodyStyle("padding:5px 5px 0")
->setWidth(210)
->setDefaults(new PhpExt_Config_ConfigObject(array
("width"=>100)))
->setDefaultType("textfield")
->setMethod(PhpExt_Form_FormPanel::METHOD_POST)
->setMonitorValid(false);

$login = PhpExt_Form_TextField::createTextField("login","User");

$pass = PhpExt_Form_PasswordField::createPasswordField
("pass","Password");

////////////////////////////
$click = PhpExt_Javascript::stm("

var redirect = 'login.php';
window.location = redirect;
");
$click1 = PhpExt_Javascript::stm
("
simple.getForm().submit({method:'POST',
url: 'login.php'
});
");
$func = new PhpExt_Handler($click,$click1);
////////////////////////////////////////////////////////////////////////////////////////////////////////////////

$submit = PhpExt_Button::createTextButton("Connect")
->setType(PhpExt_Button::BUTTON_TYPE_SUBMIT)
->setHandler($func);


$simple->addItem($login)
->addItem($pass);

$simple->addButton($submit);

$east->addItem($simple);
?>

and in my OnReady function i have this code:
$simple->getJavascript(false, "simple"),
$simple->render("simple")

please help me as soon as possible and thank you in advance

Ba9

unread,
Feb 24, 2009, 5:19:10 AM2/24/09
to PHP-Ext
hello,
I use in my web application the component complex(Border,
Accordion,tab ) and I want to create a login form in the east region
but I can't fetch the user value and the password value in my file
recovery login.php
this is my code :

<?php
// East Region
$east = new PhpExt_Panel();
$east->setTitle(utf8_encode("Menu"))
->setCollapsible(true)
->setWidth(200);


//****************************** login Form**************************
$form = new PhpExt_Form_FormPanel();
$form->setStandardSubmit(true)
->setLabelWidth(75)
->setUrl("login.php")
->setFrame(true)
->setBodyStyle("padding:5px 5px 0")
->setWidth(210)
->setDefaults(new PhpExt_Config_ConfigObject(array
("width"=>100)))
->setDefaultType("textfield")
->setMethod(PhpExt_Form_FormPanel::METHOD_POST)
->setMonitorValid(false);

$login = PhpExt_Form_TextField::createTextField("login","User");

$pass = PhpExt_Form_PasswordField::createPasswordField
("pass","Password");


$click = PhpExt_Javascript::stm("

var redirect = 'login.php';
window.location = redirect;
");
$click1 = PhpExt_Javascript::stm
("

form.getForm().submit
({method:'POST',
url: 'login.php'
});
");
$func = new PhpExt_Handler($click,$click1);
////////////////////////////////////////////////////////////////////////////////////////////////////////////////

$submit = PhpExt_Button::createTextButton("Connect")
->setType(PhpExt_Button::BUTTON_TYPE_SUBMIT)
->setHandler($func);



$form->addItem($login)
->addItem($pass);

$form->addButton($submit);

$east->addItem($form);

and in my OnReady function I add this code :

$form->getJavascript(false, "form"),
$form->render("form"),

please help me as soon as possible and thank you in advance.

Ba9

unread,
Feb 24, 2009, 6:15:20 AM2/24/09
to PHP-Ext
hello,
I use in my web application the component complex(Border,
Accordion,tab ) and I want to create a login form in the east region
but I can't fetch the user value and the password value in my file
recovery.
can someone send me an example.

Sergei Walter Guerra

unread,
Feb 25, 2009, 10:59:48 AM2/25/09
to php...@googlegroups.com
I think the problem is in the PhpExt_Handler constructor. You are setting two statements for the handler function:

var redirect = 'login.php';
window.location = redirect;


and 

simple.getForm().submit({method:'POST',
url: 'login.php'});

the generated javascript for that should be:

function() {
   var redirect = 'login.php';
   window.location = redirect;
   simple.getForm().submit({method:'POST',
      url: 'login.php'});
}

if you look closely you are redirecting the page before making the submit.  Try not including the first statement as

$func = new PhpExt_Handler($click1);

I think that should make the submit as standard submit (since you are using '$simple->setStandardSubmit(true)' ) and send a post to login.php as you intend.

Let me know if that works

Sergei Walter
ser...@gmail.com

Ba9

unread,
Feb 25, 2009, 12:02:54 PM2/25/09
to PHP-Ext
I try to put ($func = new PhpExt_Handler($click1);) only
but in this case the redirection to login.php don't work....

On 25 fév, 16:59, Sergei Walter Guerra <serg...@gmail.com> wrote:
> I think the problem is in the PhpExt_Handler constructor. You are setting
> two statements for the handler function:
>
> var redirect = 'login.php';
> window.location = redirect;
>
> and
>
> simple.getForm().submit({method:'POST',
> url: 'login.php'});
>
> the generated javascript for that should be:
>
> function() {
>    var redirect = 'login.php';
>    window.location = redirect;
>    simple.getForm().submit({method:'POST',
>       url: 'login.php'});
>
> }
>
> if you look closely you are redirecting the page before making the submit.
>  Try not including the first statement as
>
> $func = new PhpExt_Handler($click1);
>
> I think that should make the submit as standard submit (since you are using
> '$simple->setStandardSubmit(true)' ) and send a post to login.php as you
> intend.
>
> Let me know if that works
>
> Sergei Walter
> serg...@gmail.com
>
>
>
> On Tue, Feb 24, 2009 at 3:50 AM, Ba9 <baklouti.wa...@gmail.com> wrote:
>
> > Hello,
> > I use in my web application the complex (Border,Accordion,tab ) and I
> > want to create a login form in the east region but at this moment I
> > can't fetch the value of the user and password with Post method then
> > this my code :
>
> > <?php
> > // East Region
> > $east = new PhpExt_Panel();
> > $east->setTitle(utf8_encode("Menu"))
> >     ->setCollapsible(true)
> >     ->setWidth(200);
>
> > //
>
> > ***********************SimpleForm******************************************­********************************
> > ///////////////////////////////////////////////////////////////////////////­/////////////////////////////////////
>
> > $submit = PhpExt_Button::createTextButton("Connect")
> >        ->setType(PhpExt_Button::BUTTON_TYPE_SUBMIT)
> >                ->setHandler($func);
>
> > $simple->addItem($login)
> >       ->addItem($pass);
>
> > $simple->addButton($submit);
>
> > $east->addItem($simple);
> > ?>
>
> > and in my OnReady function i have this code:
> > $simple->getJavascript(false, "simple"),
> > $simple->render("simple")
>
> > please help me as soon as possible and thank you in advance- Masquer le texte des messages précédents -
>
> - Afficher le texte des messages précédents -

Sergei Walter Guerra

unread,
Feb 25, 2009, 12:19:51 PM2/25/09
to php...@googlegroups.com
try not putting a handler for the submit button.  since you are using button type submit it should work for the form.  If this doesn't work try this on the button handler

new PhpExt_Handler( 
         // Set the form's action to the corresponding URL 
          PhpExt_Javascript::stm('f.getForm().getEl().dom.action = "action.php"'), 
         // Call for submit on the underlying BasicForm object, it should do normal submit if standardSubmit == true 
          PhpExt_Javascript::stm('f.getForm().submit()') 
         ) 
     )); 

See the quoted text.  
Remember to change 'f' by your javascript name for the form, in this case 'simple'


Sergei Walter
ser...@gmail.com

Ba9

unread,
Feb 26, 2009, 9:22:19 AM2/26/09
to PHP-Ext
Hello Segei,
I try all of this case but i can't fetch the solution...
may be the problem provide from an another reason especially $_Post/
$_Get also don't work.


On 25 fév, 18:19, Sergei Walter Guerra <serg...@gmail.com> wrote:
> try not putting a handler for the submit button.  since you are using button
> type submit it should work for the form.  If this doesn't work try this on
> the button handler
> new PhpExt_Handler(
>          // Set the form's action to the corresponding URL
>           PhpExt_Javascript::stm('f.getForm().getEl().dom.action
> = "action.php"'),
>          // Call for submit on the underlying BasicForm object, it
> should do normal submit if standardSubmit == true
>           PhpExt_Javascript::stm('f.getForm().submit()')
>          )
>      ));
>
> you can see the full example on this threadhttp://groups.google.com/group/php-ext/browse_thread/thread/eac730a0d...
> See the quoted text.
> Remember to change 'f' by your javascript name for the form, in this case
> 'simple'
>
> Sergei Walter
> serg...@gmail.com
> > > - Afficher le texte des messages précédents -- Masquer le texte des messages précédents -

Massimiliano Fabbri

unread,
Feb 26, 2009, 1:19:39 PM2/26/09
to php...@googlegroups.com
if you have an object called window, change his name...eg: win1
the interpreyer java make confusion the window of the expression
window.locate
hope this helps

take a look to the post: 'a real working login form'.....

Ba9 ha scritto:
Reply all
Reply to author
Forward
0 new messages