Showing posts with label Workshop 5 - To do (Red team) Part C. Show all posts
Showing posts with label Workshop 5 - To do (Red team) Part C. Show all posts
Saturday, April 18, 2009
Workshop 5: Admiring the secenery Forms, AJAX screen layout and and mobile interfraces: To Do (RED team) Part C Screen layouts: passing data 11.:
Report your progress or findings in your Developers Blog.
Workshop 5: Admiring the secenery Forms, AJAX screen layout and and mobile interfraces: To Do (RED team) Part C Screen layouts: passing data 10.:
Submit the forms data. What do you find?
How it works
When you use the params method in Rails, it implements the details of the parameter hash to be changed without breaking existing code. For example, the params hash for radios1 will contain the value of the radio button and the data is extracted in the cabtype action. With the multiple list box example in Rails, using the select controls, the params hash of building1 is an associative array (dictionary) holding the users multiple selections and is not just a drop-down list.
Rails supports other HTML controls for forms processing via text fields, check boxes, radio buttons and list select controls etc. As an example start_form_tag abd stop_form_tag as well as methods for each item such as the create field method text_field_tag
How it works
When you use the params method in Rails, it implements the details of the parameter hash to be changed without breaking existing code. For example, the params hash for radios1 will contain the value of the radio button and the data is extracted in the cabtype action. With the multiple list box example in Rails, using the select controls, the params hash of building1 is an associative array (dictionary) holding the users multiple selections and is not just a drop-down list.
Rails supports other HTML controls for forms processing via text fields, check boxes, radio buttons and list select controls etc. As an example start_form_tag abd stop_form_tag as well as methods for each item such as the create field method text_field_tag
Workshop 5: Admiring the secenery Forms, AJAX screen layout and and mobile interfraces: To Do (RED team) Part C Screen layouts: passing data 9.:
Start the Web server and go to the opening page of this application at http://localhost:3000/input.html
Workshop 5: Admiring the secenery Forms, AJAX screen layout and and mobile interfraces: To Do (RED team) Part C Screen layouts: passing data 7.:
Edit the vehicle_controller.rb here is a start. The data in each form element in the Rails application can be accessed via its name and a hash called params
class VehicleController< ApplicationController
def cabtype
@data1 = params[:text1]
@data2 = params[:check1]
@data3 = params[:radios1]
@data4 = params[:building1]
end
end
class VehicleController< ApplicationController
def cabtype
@data1 = params[:text1]
@data2 = params[:check1]
@data3 = params[:radios1]
@data4 = params[:building1]
end
end
Workshop 5: Admiring the secenery Forms, AJAX screen layout and and mobile interfraces: To Do (RED team) Part C Screen layouts: passing data 5.:
Save the view and restart the Web server and navigate to http://localhost:3000/cabs/cabtype
Workshop 5: Admiring the secenery Forms, AJAX screen layout and and mobile interfraces: To Do (RED team) Part C Screen layouts: passing data 4.:
Add a view template - cabs\app\views\vehicle\cabtype.rhtml
We will edit this view in later steps but you may like to add your own test HTML code to the view at this stage.
We will edit this view in later steps but you may like to add your own test HTML code to the view at this stage.
Workshop 5: Admiring the secenery Forms, AJAX screen layout and and mobile interfraces: To Do (RED team) Part C Screen layouts: passing data 3.:
Add an action to vehicle_controller.rb as the method called cabtype
class VehicleController< ApplicationController
def cabtype
end
end
class VehicleController< ApplicationController
def cabtype
end
end
Workshop 5: Admiring the secenery Forms, AJAX screen layout and and mobile interfraces: To Do (RED team) Part C Screen layouts: passing data 2.:
Create a controller called Vehicle in cabs\app\controllers
cabs> ruby script/generate controller Vehicle
cabs> ruby script/generate controller Vehicle
Workshop 5: Admiring the secenery Forms, AJAX screen layout and and mobile interfraces: To Do (RED team) Part C Screen layouts: passing data 1.:
Create a new application called cabs in the same projects directory to demonstrate the use of an active view.
> rails cabs
> cd cabs
> rails cabs
> cd cabs
Subscribe to:
Posts (Atom)

