Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

change radio button to Text

Status
Not open for further replies.

edgarv

MIS
Joined
Jul 25, 2003
Messages
248
Location
US

hello, I am working on a script for our office football pool, how could I change a radio button to a text field

this is what the origial code looks like
<td>Tie</td>
<td align="center"><input class="radio" name="pick-<% = games(i).id %>" type="radio" value="<% = TIE_STR %>" <% = IsChecked(pick, TIE_STR) %> /></td>

this is what I have changed
<td>Points</td> <td align="center"><input name="points" type="text" size="5" maxlength="2" /></td>

I created a field called points in my database, but whenever I enter something in the form it does not updates it to my db I already have the db connection, what I don't understand is how come the radio button updates but not the new field I created


Thanks
ev
 
did you use

request.form("points") instead of

request.form("pickid")

because you not only changed the form element but also changed its name...

-DNG
 
I tried to locate the request.form and it is a bit complicated for me here is what it look like

if Request.ServerVariables("Content_Length") > 0 then
tb = Request.Form("tb")

'Administrator may not make entries.

if Session("FootballPoolUsername") = ADMIN_USERNAME then
call ErrorMessage("User '" & ADMIN_USERNAME & "' may not enter picks.")
errorFlag = true

'If all games locked, no changes allowed.

elseif allLocked then
call ErrorMessage("All games for this week have been locked out, changes not accepted.")
errorFlag = true

'Check tie breaker value.

else
if tb = "" then
call ErrorMessage("You must enter a point total for the tie breaker, changes not accepted.")
errorFlag = true
elseif not IsNumeric(tb) then
call ErrorMessage("Tie breaker point total must be numeric, changes not accepted.")
errorFlag = true
elseif tb < 0 or CDbl(tb) <> Round(CDbl(tb)) then
call ErrorMessage("Invalid tie breaker point value, changes not accepted.")
errorFlag = true
end if

end if

'Check for picks in locked out games

if not allLocked then
anyLocked = false
for i = 0 to UBound(games)
if Request.Form("pick-" & games(i).id) <> "" and games(i).isLocked then
call ErrorMessage(games(i).visitorName & " at " & games(i).homeName _
& " has been locked, this change not accepted.")
errorFlag = true
anyLocked = true
end if
next
if anyLocked then
call ErrorMessage("Please resubmit to update remaining picks.")
end if
end if


if not allLocked then
anyLocked = false
for i = 0 to UBound(games)
if Request.Form("pick1-" & games(i).id) <> "" and games(i).isLocked then
call ErrorMessage(games(i).visitorName & " at " & games(i).homeName _
& " has been locked, this change not accepted.")
errorFlag = true
anyLocked = true
end if
next
if anyLocked then
call ErrorMessage("Please resubmit to update remaining picks.")
end if
end if

'If there were no errors, process the data and redirect the user to the
'results page.

if not errorFlag then
for i = 0 to UBound(games)
pick = Request.Form("pick-" & games(i).id)
if pick = "" then
pick = GetPick(games(i).id)
end if
sql = "delete from Picks" _
& " where Username = '" & Session("FootballPoolUsername") & "'" _
& " and GameID = " & games(i).id
set rs = DbConn.Execute(sql)
sql = "insert into Picks" _
& " (Username, GameID, Pick, Pick1)" _
& " values('" & Session("FootballPoolUsername") & "'," _
& " '" & games(i).id & "', " _
& " '" & pick & "')"

set rs = DbConn.Execute(sql)
next
if tb <> "" then
sql = "delete from TieBreaker" _
& " where Week = " & week _
& " and Username = '" & Session("FootballPoolUsername") & "'"
set rs = DbConn.Execute(sql)
sql = "insert into TieBreaker" _
& " (Week, Username, TBPoints)" _
& " values(" & week & ", '" & Session("FootballPoolUsername") & "'," _
& " " & tb & ")"
set rs = DbConn.Execute(sql)
end if
Response.Redirect("results.asp?week=" & week)
end if

end if

'Build the form. %>


and up to this point I am completly lost
 
where ever you find this :

if Request.Form("pick-" & games(i).id)

replace it with

if Request.Form("points")

because the first one is referring to your radio button and the second one refers to text box which you wanted your radio button to change to...

let me know how the things go...i would suggest you to get the logic used in the code and replace with the text box accordingly...

-DNG
 
sorry for the ignorance, but if I replace if Request.Form("pick-" & games(i).id)

replace it with

if Request.Form("points")

what would that do to my picks radio buttons?
I have 3 radio buttons home team, visiting team and Tie

I want to get rid of the Tie radio button and be able to enter points, and I also would like to keep the other two radio buttons
 
i thought you wanted to change your radio buttons to text input's. This is what you said: "how could I change a radio button to a text field"

so you have 3 radio buttons??? do you want to change all these to text boxes or do you have 1 text box and 2 radio buttons...

-DNG
 
1 text box and two radio buttons, I am sorry for the confusion, I sometimes complicate things.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top