How to populate radio button from boolean db field

Results 1 to 3 of 3

Thread: How to populate radio button from boolean db field

  1. #1
    Join Date
    Dec 1969
    Posts
    745

    Default How to populate radio button from boolean db field

    I have a page that retrieves data from a database. Some of the fields are boolean and I would like to display a page where the boolean fields set the appripriate radio buttons to on or off based on the field status (true/false). If anybody could post any code snippets I&#039d appreciate it.<BR><BR>Thanks in advance!

  2. #2
    Join Date
    Dec 1969
    Posts
    168

    Default RE: How to populate radio button from boolean db f

    &#060;%<BR>&#039name is the name of the radio button<BR>&#039v is the value of the radio button<BR>&#039db is what is in your db i.e. rs.fields("test").Value<BR>&#039if v=db the function returns a selected radio button, otherwise it returns an unselected radio button<BR><BR>Function mkradio(name,v,db)<BR>output ="&#060;input type=""radio"" name=""" & name & """ value=""" & v & """"<BR>If db=v then output= output & " checked"<BR>output = output & "&#062;"<BR>mkradio = output<BR>end function<BR>%&#062;<BR><BR>&#060;%=mkradio(test,"t rue","false")%&#062;True&#060;p&#062;<BR>&#060;%=m kradio(test,"false","false")%&#062;False&#060;p&#0 62;<BR><BR>Hope this helps.. Cheers!

  3. #3
    Join Date
    Dec 1969
    Posts
    745

    Default RE: How to populate radio button from boolean db f

    Great, thanks, I love you!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •