B4R Code Snippet RadioButton with ESP Server

Hans- Joachim Krahe

Active Member
Licensed User
ho = start value of radiobutton

B4X:
        Select ho
            Case 0
                Astream.Write("<div><input Type=""radio"" id=""rb1o"" name=""ho"" value=""rb1o""checked><label For=""rb1o"">1</label>")
                Astream.Write("<input Type=""radio"" id=""rb2o"" name=""ho"" value=""rb2o""><label For=""rb2o"">2</label>")
                Astream.Write("<input Type=""radio"" id=""rb3o"" name=""ho"" value=""rb3o""><label For=""rb3o"">3</label></div><br />")
            Case 1
                Astream.Write("<div><input Type=""radio"" id=""rb1o"" name=""ho"" value=""rb1o""><label For=""rb1o"">1</label>")
                Astream.Write("<input Type=""radio"" id=""rb2o"" name=""ho"" value=""rb2o""checked><label For=""rb2o"">2</label>")
                Astream.Write("<input Type=""radio"" id=""rb3o"" name=""ho"" value=""rb3o""><label For=""rb3o"">3</label></div><br />")
            Case 2
                Astream.Write("<div><input Type=""radio"" id=""rb1o"" name=""ho"" value=""rb1o""><label For=""rb1o"">1</label>")
                Astream.Write("<input Type=""radio"" id=""rb2o"" name=""ho"" value=""rb2o""><label For=""rb2o"">2</label>")
                Astream.Write("<input Type=""radio"" id=""rb3o"" name=""ho"" value=""rb3o""checked><label For=""rb3o"">3</label></div><br />")
                
        End Select

Browser will answer: ho = (rb1o or rb2o or rb3o)

... may be, there will be an easier solutiuon, but at all - it works:)
 
Last edited:
Top