July 12, 2013, 9:50pm
I am just starting to use Yii and so far I am very impressed. However since my programming skills are very basic I am looking for tutorials that describe step by step what I need to do.
The tutorial that I am looking for is a step by step tutorial on how to create my first form. There are several to be found but in my opinion all of them assume some level of knowledge that I lack.
If someone can be as kind to explain to me how I can start making my own forms in the simplest of steps like:
Create Myfirsform.php in /testdrive/models/
put this and that code to …
create myfirstform.php in /testdrive/controllers/
put this and that code
for example at
Creating a Simple Form
In the following, we show how to use the form builder to create a login form.
First, we write the login action code:
it does not specify in what folder I need to create a file. I am really trying to figure out what the basic steps are.
Thanks in advance,
July 13, 2013, 1:26pm
I`m also new in Yii but I will try to tell you what i know. I will use example from your link.
public function actionLogin()
$model = new LoginForm;
$form = new CForm('application.views.site.loginForm', $model);
if($form->submitted('login') && $form->validate())
$form = (…) and path for it:
, next is validation and if condition:
As the code reads, if the form is submitted and all inputs are validated without any error, we would redirect the user browser to the site/index page. Otherwise, we render the login view with the form.
(sry but I will not explain all of this cuz it’s kind of your job to get basics from PHP and moreover I don’t know everything.
So if u see an action, now you know where to find it.
Now please. Read
http://www.yiiframework.com/doc/guide/1.1/en/index you can really learn all the basics from guide. All my answers are from it
If you really have problems with learning from docs try tutorials from youtube.
July 13, 2013, 3:37pm
Thanks for the answer however it still doesn’t answer my original question. I am merely looking for a quick start guide on how to create a form.
Plus I think that you are mistaken in your answer. The first code snippet should go in /protected/models/LoginForm.php and not as you suggested in protected/views/site/loginForm.php
Anyway, in my opinion the documents are not very straightforward. It assumes too much knowledge of Yii from the start. It would really help if there is a very basic quick start explaining how to create an input form. Start with a Form Modal en then move to an Active Record type of form.
July 13, 2013, 3:51pm
It`s not my suggestion. Read doc its just quote from it. Have you tried Blog tutorial ? Try to build basic app and then update it with more advance things. For me it was good way to start with Yii.
July 14, 2013, 8:26am
I found a tutorial that explains exactly what I was looking for.
Check out the link below:
Where to Start with Yii