Précédent   Forum des professionnels en informatique > Webmasters - Développement Web > JavaScript > Bibliothèques & Frameworks > jQuery
jQuery Forum d'entraide sur le framework jQuery. Avant de poster : Tutoriels jQuery, FAQ jQuery, Tous les tutoriels JavaScript, Toutes les FAQ JavaScript
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 01/12/2011, 09h19   #1
Invité de passage
 
Inscription : août 2008
Messages : 8
Détails du profil
Informations forums :
Inscription : août 2008
Messages : 8
Points : 0
Points : 0
Par défaut Jformer : clé redirect de la fonction onSubmit()

je sui entrain d'utiliser la classe jformer qui permet de crée des formulaire aussi facilement et avec des test de validation et d'autre option.
je suis débutant entrain de tester cette class jformer j'ai crée un formulaire d'authentification dans une page login.php qui redirige ver une page form.php tous les test de validation marche très bien mais la redirection ça ne marche pas, firefoxe m'affiche l'erreur suivant :
Firefox ne sait pas ouvrir cette adresse car le protocole (d) n'est associé à aucun programme.
voici le code de la page login.php
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test Jformer</title>
<link rel="stylesheet" type="text/css" href="lib/jformer.css" />
<script type="text/javascript" src="lib/jquery-1.5.2.min.js"></script>
<script type="text/javascript" src="lib/jformer.js"></script>
</head>
<body>
<div style="width:980px; margin:0 auto">
<?php include("jformer.php"); ?>
<?php // Create the form
// Create the form
$login = new JFormer('loginForm', array(
    'submitButtonText' => 'Login',
));
 
// Create the form page
$jFormPage1 = new JFormPage($login->id.'Page', array(
    'title' => '<p>Login Demo</p>',
));
 
// Create the form section
$jFormSection1 = new JFormSection($login->id.'Section', array());
 
// Check to see if the remember me checkbox should be checked by default
 
// Add components to the section
$jFormSection1->addJFormComponentArray(array(
    new JFormComponentSingleLineText('username', 'Username:', array(
        'validationOptions' => array('required', 'username'),
        'tip' => '<p>The demo login is <b>admin</b>.</p>',
    )),
 
    new JFormComponentSingleLineText('password', 'Password:', array(
        'type' => 'password',
        'validationOptions' => array('required', 'password'),
        'tip' => '<p>Password is 12345</p>',
    )),
 
    new JFormComponentMultipleChoice('rememberMe', '', 
        array(
            array('value' => 'remember', 'label' => 'Keep me logged in on this computer')
        ),
        array(
        'tip' => '<p>If a cookie is set you can have this checked by default.</p>',
        )
    ),
));
 
// Add the section to the page
$jFormPage1->addJFormSection($jFormSection1);
 
// Add the page to the form
$login->addJFormPage($jFormPage1);
 
// Set the function for a successful form submission
function onSubmit($formValues) {
    $formValues = $formValues->loginFormPage->loginFormSection;
 
    if($formValues->username == 'admin' && $formValues->password == '12345') {
        if(!empty($formValues->rememberMe)) {
            $response = array('redirect' => 'form.php');
        }
        else {
            $response = array('successPageHtml' => '<p>Login Successful</p><p>We won\'t keep you logged in on this computer.</p>');
        }
    }
    else {
        $response = array('failureNoticeHtml' => 'Invalid username or password.', 'failureJs' => "$('#password').val('').focus();");
    }
 
    return $response;
}
 
// Process any request to the form
$login->processRequest();
?>
</div>
</body>
</html>
est ce que quel qu'un peut m'aider
med_tijani est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 19h36.


 
 
 
 
Partenaires

Hébergement Web