D
Drew
I am building an application for inserting and updating one field in a
database. The database is in SQL Server and I am using Classic ASP. I have
a dropdown listbox that is populated with names, when a name is selected it
automatically submits the form and then replaces the dropdown listbox with
the name of the resident selected. Now I need to take a field and split it
into 2 textboxes. This is where my problems begin. The field is named
ProblemO and looks something like this,
..150 This is a sample term
I need to break this field up into Code and Term. Code being the .150 and
the Term being "This is a sample term". I did this with the following code,
Dim Problem
Dim ProbCode
Dim ProbTerm
Problem = rsProblem0.Fields.Item("ProblemO").Value
ProbCode = Left(Problem,4)
ProbTerm = Trim(Right(Problem,(Len(Problem)-4)))
If I Response.Write the above variables out, it is perfect, but if I try to
make them default values for a textbox I am running into issues. The
ProbCode works fine, but the ProbTerm cuts off at the first space. Below is
my code,
If rsProblem0.BOF And rsProblem0.EOF Then
Response.Write("<input name=""ProblemCode"" type=""text""
id=""ProblemCode"" size=""6""> - <input name=""ProblemTerm"" type=""text""
id=""ProblemTerm"" size=""40"">")
Else
Response.Write("<input name=""ProblemCode"" type=""text""
id=""ProblemCode"" value=" & ProbCode & " size=""6""> - <input
name=""ProblemTerm"" type=""text"" id=""ProblemTerm"" value=" & ProbTerm &
"size=""40"">")
End If
How can I get this to work correctly?
Thanks,
Drew
database. The database is in SQL Server and I am using Classic ASP. I have
a dropdown listbox that is populated with names, when a name is selected it
automatically submits the form and then replaces the dropdown listbox with
the name of the resident selected. Now I need to take a field and split it
into 2 textboxes. This is where my problems begin. The field is named
ProblemO and looks something like this,
..150 This is a sample term
I need to break this field up into Code and Term. Code being the .150 and
the Term being "This is a sample term". I did this with the following code,
Dim Problem
Dim ProbCode
Dim ProbTerm
Problem = rsProblem0.Fields.Item("ProblemO").Value
ProbCode = Left(Problem,4)
ProbTerm = Trim(Right(Problem,(Len(Problem)-4)))
If I Response.Write the above variables out, it is perfect, but if I try to
make them default values for a textbox I am running into issues. The
ProbCode works fine, but the ProbTerm cuts off at the first space. Below is
my code,
If rsProblem0.BOF And rsProblem0.EOF Then
Response.Write("<input name=""ProblemCode"" type=""text""
id=""ProblemCode"" size=""6""> - <input name=""ProblemTerm"" type=""text""
id=""ProblemTerm"" size=""40"">")
Else
Response.Write("<input name=""ProblemCode"" type=""text""
id=""ProblemCode"" value=" & ProbCode & " size=""6""> - <input
name=""ProblemTerm"" type=""text"" id=""ProblemTerm"" value=" & ProbTerm &
"size=""40"">")
End If
How can I get this to work correctly?
Thanks,
Drew