HELP: Odd behaviour of ASP form

J

John

Hi all,
My problem is this.
I have a page with a data input form, and that forms submits it to an
Access database (I've checked, it is there)

I have another page which displays the same form boxes written in ASP.
using ASP, the intention is to display previously entered database
info ready for editing/updating.

On this page is...
a textbox
a textbox
a text area
a text area
a text box
a text box
a text box
a text box

The only ones which seem to display correctly are the bottom 4 text
boxes.
The top two text boxes only display the first word of that content.
The two text area boxes display nothing.

the relevant pieces of code are....

Response.Write "<p class=""formheadings"">Edit Company Name (max
length 40)</p>"
Response.Write "<p><input type=""text"" name=""company"" value=" &
objRS("Company") & " size=""40"" tabindex=""1"" maxlength=""40""
class=""formcontent""></p>"

Response.Write "<p class=""formheadings"">Edit Article Heading (max
length 100)</p>"
Response.Write "<p><input type=""text"" name=""heading"" value=" &
objRS("Heading") & "size=""40"" tabindex=""2"" maxlength=""100""
class=""formcontent""></p>"

I'M BAFFLED!
Any ideas anyone?
TIA,
 
J

Jon Spivey

Hi John,

You need to add quotes around the values, so instead of
<input type=""text"" name=""company"" value=" & objRS("Company") & "
size=""40"" tabindex=""1"" maxlength=""40"" class=""formcontent"">
do this
<input type=""text"" name=""company"" value=""" & objRS("Company") & """
size=""40"" tabindex=""1"" maxlength=""40"" class=""formcontent"">
 
J

John

Thanks Jon, but that didn't work either...it ends up displaying objRS(
and is looking for a closing quote.
I even tried it with extra quotes around Company, but to no avail.

I think I'm developing a quote phobia.

Im open to other suggestions.
 
T

Thomas A. Rowe

Change the field values to


<input type=""text"" name=""company"" value="<%=objRS("Company")%>"
size=""40"" tabindex=""1"" maxlength=""40"" class=""formcontent"">

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, WebCircle, MS KB Quick Links, etc.
==============================================
 
J

John

Thanks Thomas, but that didn't work either as ASP is already being
used so using <% within <% doesn't work.
The only code that appears to produce anything is the original I
posted, which is....

Response.Write "<p><input type=""text"" name=""company"" value=" &
objRS("Company") & " size=""40"" tabindex=""1"" maxlength=""40""
class=""formcontent""></p>"

But once again it cuts the value string short after the first word.

I am beginning to lose faith in solving this.

Any more help would be appreciated.
TIA
 
T

Thomas A. Rowe

Remove all of the response.write statements from your page along with the double quotes and should
<%=objRS("fieldname")%> should work correctly unless you are generating this form on the fly where
you would need to use response.write.

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, WebCircle, MS KB Quick Links, etc.
==============================================
 
J

Jon Spivey

John,
you need to get quotes around the value. For example consider this HTML
<input type="text" value=some text>
will only display the value as some
but
<input type="text" value="some text">
will display some text as the value.

Please look at my original reply again - it's the answer to your issue
 
J

John

Thanks Thomas.
Yes I am generating the form on the fly with asp at the moment, so I
think I'll try it with html intermixed with your asp suggestion and
see what happens.
 
T

Thomas A. Rowe

ASP is slower when you use response.write statements, as the ASP engine has to process the HTML code
as well, whereas the method I learned separate the ASP code from the HTML code.

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, WebCircle, MS KB Quick Links, etc.
==============================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top