Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
69b2b372
Commit
69b2b372
authored
Apr 28, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
form wip
parent
74246a23
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
121 additions
and
70 deletions
+121
-70
LoginForm.php
app/protected/models/LoginForm.php
+2
-0
main.php
app/protected/views/layouts/main.php
+4
-2
login.php
app/protected/views/site/login.php
+2
-8
Html.php
framework/helpers/base/Html.php
+7
-6
BooleanValidator.php
framework/validators/BooleanValidator.php
+2
-2
ActiveField.php
framework/widgets/ActiveField.php
+92
-47
ActiveForm.php
framework/widgets/ActiveForm.php
+12
-5
No files found.
app/protected/models/LoginForm.php
View file @
69b2b372
...
...
@@ -18,6 +18,7 @@ class LoginForm extends Model
{
public
$username
;
public
$password
;
public
$rememberMe
=
true
;
public
function
rules
()
{
...
...
@@ -25,6 +26,7 @@ class LoginForm extends Model
array
(
'username'
,
'required'
),
array
(
'password'
,
'required'
),
array
(
'password'
,
'validatePassword'
),
array
(
'rememberMe'
,
'boolean'
),
);
}
...
...
app/protected/views/layouts/main.php
View file @
69b2b372
...
...
@@ -5,10 +5,11 @@
*/
use
yii\helpers\Html
;
?>
<?php
$this
->
beginPage
();
?>
<!DOCTYPE html>
<html>
<?php
$this
->
beginPage
();
?>
<head>
<meta
charset=
"utf-8"
/>
<title>
<?php
echo
Html
::
encode
(
$this
->
title
);
?>
</title>
<?php
$this
->
head
();
?>
</head>
...
...
@@ -18,5 +19,5 @@ use yii\helpers\Html;
<?php
echo
$content
;
?>
<?php
$this
->
endBody
();
?>
</body>
<?php
$this
->
endPage
();
?>
</html>
<?php
$this
->
endPage
();
?>
\ No newline at end of file
app/protected/views/site/login.php
View file @
69b2b372
...
...
@@ -14,13 +14,6 @@ use yii\helpers\Html;
<?php
$form
=
$this
->
beginWidget
(
'yii\widgets\ActiveForm'
);
?>
<?php
echo
$form
->
field
(
$model
,
'username'
)
->
textInput
();
?>
<?php
echo
$form
->
field
(
$model
,
'password'
)
->
passwordInput
();
?>
<?php
$field
=
$form
->
field
(
$model
,
'username'
);
echo
$field
->
begin
()
.
"
\n
"
.
$field
->
label
()
.
"
\n
"
.
Html
::
activeTextInput
(
$model
,
'username'
)
.
"
\n
"
.
$field
->
error
()
.
"
\n
"
.
$field
->
end
();
?>
<?php
echo
$form
->
field
(
$model
,
'rememberMe'
)
->
checkbox
();
?>
<?php
echo
Html
::
submitButton
(
'Login'
);
?>
<?php
$this
->
endWidget
();
?>
\ No newline at end of file
framework/helpers/base/Html.php
View file @
69b2b372
...
...
@@ -771,7 +771,7 @@ class Html
* @param array $items the data item used to generate the checkboxes.
* The array keys are the labels, while the array values are the corresponding checkbox values.
* Note that the labels will NOT be HTML-encoded, while the values will.
* @param array $options options (name => config) for the checkbox list. The following options are s
pecially handl
ed:
* @param array $options options (name => config) for the checkbox list. The following options are s
upport
ed:
*
* - unselect: string, the value that should be submitted when none of the checkboxes is selected.
* By setting this option, a hidden input will be generated.
...
...
@@ -785,7 +785,7 @@ class Html
*
* where $index is the zero-based index of the checkbox in the whole list; $label
* is the label for the checkbox; and $name, $value and $checked represent the name,
* value and the checked status of the checkbox input.
* value and the checked status of the checkbox input
, respectively
.
* @return string the generated checkbox list
*/
public
static
function
checkboxList
(
$name
,
$selection
=
null
,
$items
=
array
(),
$options
=
array
())
...
...
@@ -829,7 +829,7 @@ class Html
* @param array $items the data item used to generate the radio buttons.
* The array keys are the labels, while the array values are the corresponding radio button values.
* Note that the labels will NOT be HTML-encoded, while the values will.
* @param array $options options (name => config) for the radio button list. The following options are s
pecially handl
ed:
* @param array $options options (name => config) for the radio button list. The following options are s
upport
ed:
*
* - unselect: string, the value that should be submitted when none of the radio buttons is selected.
* By setting this option, a hidden input will be generated.
...
...
@@ -843,7 +843,7 @@ class Html
*
* where $index is the zero-based index of the radio button in the whole list; $label
* is the label for the radio button; and $name, $value and $checked represent the name,
* value and the checked status of the radio button input.
* value and the checked status of the radio button input
, respectively
.
* @return string the generated radio button list
*/
public
static
function
radioList
(
$name
,
$selection
=
null
,
$items
=
array
(),
$options
=
array
())
...
...
@@ -885,8 +885,9 @@ class Html
* If a value is null, the corresponding attribute will not be rendered.
* The following options are specially handled:
*
* - label: this specifies the label to be displayed. If this is not set, [[Model::getAttributeLabel()]]
* will be called to get the label for display. Note that this will NOT be [[encoded()]].
* - label: this specifies the label to be displayed. Note that this will NOT be [[encoded()]].
* If this is not set, [[Model::getAttributeLabel()]] will be called to get the label for display
* (after encoding).
*
* @return string the generated label tag
*/
...
...
framework/validators/BooleanValidator.php
View file @
69b2b372
...
...
@@ -70,8 +70,8 @@ class BooleanValidator extends Validator
*/
public
function
validateValue
(
$value
)
{
return
$this
->
strict
&&
(
$value
==
$this
->
trueValue
||
$value
==
$this
->
falseValue
)
||
!
$this
->
strict
&&
(
$value
===
$this
->
trueValue
||
$value
===
$this
->
falseValue
);
return
!
$this
->
strict
&&
(
$value
==
$this
->
trueValue
||
$value
==
$this
->
falseValue
)
||
$this
->
strict
&&
(
$value
===
$this
->
trueValue
||
$value
===
$this
->
falseValue
);
}
/**
...
...
framework/widgets/ActiveField.php
View file @
69b2b372
This diff is collapsed.
Click to expand it.
framework/widgets/ActiveForm.php
View file @
69b2b372
...
...
@@ -30,6 +30,11 @@ class ActiveForm extends Widget
* Defaults to 'post'.
*/
public
$method
=
'post'
;
/**
* @param array $options the attributes (name-value pairs) for the form tag.
* The values will be HTML-encoded using [[encode()]].
* If a value is null, the corresponding attribute will not be rendered.
*/
public
$options
=
array
();
/**
* @var string the default CSS class for the error summary container.
...
...
@@ -37,12 +42,14 @@ class ActiveForm extends Widget
*/
public
$errorSummaryCssClass
=
'yii-error-summary'
;
/**
* @var boolean whether to enable client-side data validation. Defaults to false.
* When this property is set true, client-side validation will be performed by validators
* that support it (see {@link CValidator::enableClientValidation} and {@link CValidator::clientValidateAttribute}).
* @var boolean whether to enable client-side data validation.
* Client-side validation will be performed by validators that support it
* (see [[\yii\validators\Validator::enableClientValidation]] and [[\yii\validators\Validator::clientValidateAttribute()]]).
*/
public
$enableClientValidation
=
true
;
/**
* @var array the default configuration used by [[field()]] when creating a new field object.
*/
public
$enableClientValidation
=
false
;
public
$fieldConfig
=
array
(
'class'
=>
'yii\widgets\ActiveField'
,
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment