Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Form-Building Routines III—the Conclusion  : Page 4

Use automatic control-building routines to create and populate checkbox and radio button controls from a database.


advertisement

The DisplayCheckBox Routine
The DisplayCheckBox routine uses code very similar to the DisplayTextbox routine, but outputs a checkbox. You specify the caption as the strLabel parameter.

   Sub DisplayCheckBox   (byval strLabel, _
      byval strFieldName,  _
      byval strValue, byval strCheckBoxLabel)
      Dim i
      
      Response.Write "<TR>"
      Response.write "<TD ALIGN=""RIGHT"" _
         VALIGN=""TOP"">" 
      Response.Write strLabel & "&nbsp;</FONT></TD>"
   
      Response.Write "<TD ALIGN=""LEFT"" VALIGN=""TOP"">"
   
      Response.Write "<INPUT TYPE=""CHECKBOX"" " & _
      " NAME=""" & strFieldName & """ " & _
      " VALUE=""1"">" & _
      strCheckBoxLabel 
   
      Response.Write "</TD>"
      Response.Write "</TR>"
      
      
   End Sub
Note that there is no "blnRequired" argument for the DisplayCheckBox routines since checkboxes cannot be marked as "required" on a form.

There are a few more enhancements possible on these routines, but I will discuss them in the next section that deal with more complicated radio buttons and checkboxes.


Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date