Ruby On Rails Classroom image

Pooja  Negi / Student / Web Technology

 
To post your Question Join Classroom
 
Lesson Topics's No:-  |1 | 2|Last
Lessons:- The Form HTML

  The Form HTML

As indicated by Figure 7.12, the signup page now renders properly, indicating that the form_for code in Listing 7.17 is producing valid HTML. If you look at the HTML for the generated form (using either Firebug or the ‘‘view page source’’ feature of your browser), you should see markup as in Listing 7.20. Although many of the details are irrelevant for our purposes, let’s take a moment to highlight the most important parts of its structure.

 

 

(Here I’ve omitted some HTML related to the authenticity token, which Rails automatically includes to thwart a particular kind of attack called a cross-siterequest forgery (CSRF). See the Stack Overflow entry on the Rails authenticity token if you’re interested in the details of how this works and why it’s important.)

                We’ll start with the internal structure of the document. Comparing Listing 7.17 with Listing 7.20, we see that the Embedded Ruby

 

<%=   f.label   :name  %>
<%=   f.text field  :name  %>

 

produces the HTML

 <label  for=  "user name" > Name  </label>
<input  id=  "user name"  name=  "user[name]"  size= "30"  type=  "text"  />

 

 and


<%=   f.label  :password   %>
<%=   f.password field  :password   %>
 
 
 
image
Pooja   Negi

Skills    Ruby On Rails

Qualifications :- High School - SSN high school, College/University - HNBGU, College/University - SRHU,
Location :-Ranipokhari,Rishikesh,Uttarakhand,India
Description:- Student
Explore
 

  Students (0)