Hi everyone,
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:
Step 1:
Create Myfirsform.php in /testdrive/models/
put this and that code to ..
Step 2:
create myfirstform.php in /testdrive/controllers/
put this and that code
etc.. etc..
for example at http://www.yiiframew...en/form.builder
==================
2. 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,
W/
Page 1 of 1
My First Form Step by step tutorial on how to create a form
#2
Posted 13 July 2013 - 08:26 AM
Hi there
I`m also new in Yii but I will try to tell you what i know. I will use example from your link.
$form = (...) and path for it:
, next is validation and if condition:
(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.
http://www.yiiframew...sics.controller
So if u see an action, now you know where to find it.
Now please. Read http://www.yiiframew...de/1.1/en/index you can really learn all the basics from guide. All my answers are from it
[EDIT]:
If you really have problems with learning from docs try tutorials from youtube.

public function actionLogin() { $model = new LoginForm; $form = new CForm('application.views.site.loginForm', $model); if($form->submitted('login') && $form->validate()) $this->redirect(array('site/index')); else $this->render('login', array('form'=>$form)); }
$form = (...) and path for it:
Quote
The path alias application.views.site.loginForm actually refers to the PHP file protected/views/site/loginForm.php
, next is validation and if condition:
Quote
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.
http://www.yiiframew...sics.controller
Quote
An action, in its simplest form, is just a controller class method whose name starts with action.
So if u see an action, now you know where to find it.
Now please. Read http://www.yiiframew...de/1.1/en/index you can really learn all the basics from guide. All my answers are from it

[EDIT]:
If you really have problems with learning from docs try tutorials from youtube.
#3
Posted 13 July 2013 - 10:37 AM
Hi Mentorq,
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.
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.
#4
Posted 13 July 2013 - 10:51 AM
wannabe, on 13 July 2013 - 10:37 AM, said:
Hi Mentorq,
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
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
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.
#5
Posted 14 July 2013 - 03:26 AM
I found a tutorial that explains exactly what I was looking for.
Check out the link below:
Where to Start with Yii
rgds,
W
Check out the link below:
Where to Start with Yii
rgds,
W
Share this topic:
Page 1 of 1