![]() |
| |||||||
| Sponsored Links |
![]() |
| | LinkBack | Thread Tools | Display Modes |
|
#11
| |||
| |||
| Code: <input type="checkbox" name="question1" id="question1" value"1">1
<input type="checkbox" name="question2" id="question2" value"2">2
<input type="checkbox" name="question3" id="question3" value"3">3
<input type="checkbox" name="question4" id="question4" value"4">4
<input type="checkbox" name="question5" id="question5" value"5">5
<input type="checkbox" name="question6" id="question6" value"6">6
<input type="checkbox" name="Other" id="Other" value"Other">Other
<input type="text" name="othertxt" id="othertxt" value="">
getquestion1=trim(Request.form("question1"))
getquestion2=trim(Request.form("question2"))
getquestion3=trim(Request.form("question3"))
getquestion4=trim(Request.form("question4"))
getquestion5=trim(Request.form("question5"))
getquestion6=trim(Request.form("question6"))
getOther=trim(Request.form("Other"))
getothertxt=trim(Request.form("othertxt"))
If getquestion1 <> "" Then
getquestion1=getquestion1 & ", "
End If
If getquestion2 <> "" Then
getquestion2=getquestion2 & ", "
End If
If getquestion3 <> "" Then
getquestion3=getquestion3 & ", "
End If
If getquestion4 <> "" Then
getquestion4=getquestion4 & ", "
End If
If getquestion5 <> "" Then
getquestion5=getquestion5 & ", "
End If
If getquestion6 <> "" Then
getquestion6=getquestion6 & ", "
End If
If getOther <> "" Then
If getothertxt <> "" Then
getOther=getOther & " - " & getothertxt
Else
getOther=getOther & ", "
End If
End If
finalanswer=getquestion1 & getquestion2 & getquestion3 & getquestion4 & getquestion5 & getquestion6 & getOther
can you guys tell me how to find out if there is comma at the end of string and if so then delete it todd |
| Sponsored Links |
|
#12
| ||||
| ||||
| Against my better judgment but... If you ALWAYS have a comma at the end (i.e. append a comma after getothertxt), then you know you will need to delete the last character of the string EVERY TIME.
__________________ Wolffy ------------------------ Opinions expressed are my own and do not necessity reflect those of any sane person. Any code provided is intended to be an example and is provided AS IS. Rework for your specific environment may be required. Void where prohibited by law. Not valid in California. Your mileage may vary. |
|
#13
| |||
| |||
| see if the user selects other then i dont have to worry but if the user doesnt select other then i have the problem thats where i need to delete the comma |
|
#14
| ||||
| ||||
| Append the comma if the user selects "Other" anyway. Then you will always have to remove the last character. This is what I suggested a few posts up.
__________________ jmurrayhead If you agree with me... click the icon! If my post solved your problem, click the button in the lower right-hand corner of the post.If you like it here...throw us a few bones to help support us. Join our Folding team: DeveloperBarn Folding |
| The Following User Says Thank You to jmurrayhead For This Useful Post: | ||
sbenj69 (June 19th, 2008) | ||
|
#15
| |||
| |||
| here is the code Code: <input type="checkbox" name="question1" id="question1" value"1">1
<input type="checkbox" name="question2" id="question2" value"2">2
<input type="checkbox" name="question3" id="question3" value"3">3
<input type="checkbox" name="question4" id="question4" value"4">4
<input type="checkbox" name="question5" id="question5" value"5">5
<input type="checkbox" name="question6" id="question6" value"6">6
<input type="checkbox" name="Other" id="Other" value"Other">Other
<input type="text" name="othertxt" id="othertxt" value="">
getquestion1=trim(Request.form("question1"))
getquestion2=trim(Request.form("question2"))
getquestion3=trim(Request.form("question3"))
getquestion4=trim(Request.form("question4"))
getquestion5=trim(Request.form("question5"))
getquestion6=trim(Request.form("question6"))
getOther=trim(Request.form("Other"))
getothertxt=trim(Request.form("othertxt"))
If getquestion1 <> "" Then
getquestion1=getquestion1 & ", "
End If
If getquestion2 <> "" Then
getquestion2=getquestion2 & ", "
End If
If getquestion3 <> "" Then
getquestion3=getquestion3 & ", "
End If
If getquestion4 <> "" Then
getquestion4=getquestion4 & ", "
End If
If getquestion5 <> "" Then
getquestion5=getquestion5 & ", "
End If
If getquestion6 <> "" Then
getquestion6=getquestion6 & ", "
End If
If getOther <> "" Then
If getothertxt <> "" Then
getOther=getOther & " - " & getothertxt
Else
getOther=getOther & ", "
End If
else
getOther=getOther & ", "
End If
finalanswer=getquestion1 & getquestion2 & getquestion3 & getquestion4 & getquestion5 & getquestion6 & getOther
finalanswer = left(finalanswer, len(finalanswer)-1) now it shows me 2 comma's at end of string so i tried it like this finalanswer = Trim(Left(finalanswer, Len(finalanswer) - 1)) |
|
#16
| |||
| |||
| both methods dont work |
|
#17
| ||||
| ||||
| Code: If getOther <> "" Then If getothertxt <> "" Then getOther=getOther & " - " & getothertxt & ", " Else getOther=getOther & ", " End If End If Code: finalanswer = Trim(finalanswer) finalanswer = Left(finalanswer, Len(finalanswer)-1) |
|
#18
| ||||
| ||||
| I have taken over a system that employs similar methods... ****s me to tears! Fortuantely they only store comma seperated integers, I would look at modifying the design if you can at all, and I would definately not recommend storing strings and integers jumbled up in the same list, but if you must then wollfys on the right track. Last edited by dr_rock; June 19th, 2008 at 08:31 PM. |
|
#19
| ||||
| ||||
|
__________________ "You'll never be as perfect as BLaaaaaaaaarche." |
![]() |
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| checkbox validation | todd2006 | JavaScript Programming | 3 | June 18th, 2008 07:22 PM |
| display problem checkbox | todd2006 | JavaScript Programming | 4 | May 30th, 2008 03:58 PM |