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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Only the first word seems to be passed from VFP component to ASP form.

Status
Not open for further replies.

rlawrence

Programmer
Sep 14, 2000
182
US
Hi,

I have been working on incorporating my VFP components into ASP. Trying to keep ASP very lightweight! I carry data in a VFP object created using SCATTER NAME... I can use my components to look up and capture a desired record, but when I present the data in a form for editing, I seem to get only the first word of any string variables.

Here's a VBScript code snippet that captures a record:

Code:
' Search for a title.
orc.rsTitle.oRecord.Title_ID = "COUPLET"
lFound = ormc.GetTitle(orc)

If lFound Then
	cMessage = "<h2 align='center'>" & orc.rsTitle.oRecord.Title & "</h2>"
Else
	cMessage = "<h2>No Title Found</h2>"
End If

The title field that is presented via "cMessage" is complete. However if I assign field values to a form for editing...

Code:
<form method="POST" action="SaveTitle.asp">
<table border="0" width="100%">
<tr>TITLE ID:&nbsp;&nbsp;<input type="text" name="txtTITLEID" size="20" value = <% =orc.rsTitle.oRecord.TITLE_ID %>></tr>
<tr>TITLE:&nbsp;&nbsp;<input type="text" name="edtTITLE" size="86" value = <% =orc.rsTitle.oRecord.TITLE %>></tr>
<tr>SUBTITLE:&nbsp;&nbsp;<input type="text" name="edtSUBTITLE" size="81" value = <% =orc.rsTitle.oRecord.SUBTITLE %>></tr>
.
.
.
<tr>
<input type="submit" value="Submit" name="B1">
<input type="reset" value="Reset" name="B2">
</tr>
</table>
</form>


...I get only the first word of the title and subtitle in their respective fields. Any thoughts on why this is happening?

Thanks,

Ron
 
I think that you need quotes around the TITLE and SUBTITLE. I know that quotes are optional in HTML forms if the attribute is a single word. If the attribute is more than one word then HTML takes the first word as the value and attempts to interpret the next word as an identifier.

I'm not sure how you're going to insert the quotes though. I suppose you might include single-quotes in the title itself: [TT]orc.rsTitle.oRecord.TITLE = "'My Title'"[/TT]

Geoff Franklin
 
Unbelievable! Geoff, you hit the nail on the head. Thank you.

Here's a sample INPUT element before and after the change:

Code:
<input type="text" name="txtTITLEID" size="20" value = <% =orc.rsTitle.oRecord.TITLE_ID %>>

...was changed to this...

Code:
<input type="text" name="txtTITLEID" size="20" value = "<% =orc.rsTitle.oRecord.TITLE_ID %>">

My God it's amazing how I can get hung up on the simplest of things!!!

Ron
 
O.K. I've moved beyond the issue of populating the form correctly. Perhaps I should be posting this message to a new thread. It seems better for all to retain the context of this thread however, so I decided to post here.

Now, I am trying to return the contents of the form via my ORC data object (which was created with SCATTER NAME). So, of course I am assigning REQUEST.FORM("myFieldName") back to the data object. My server is failing when it attempts to update the record using the data object due to a "data type mismatch".

After some creative debugging, I have found that VFP interprets the resulting strings from the form as objects! Does anyone know how strings are represented when returned via Request.Form()? How can I turn them back into string values recognized by VFP?

Thanks again,

Ron
 
After some creative debugging, I have found that VFP interprets the resulting strings from the form as objects!

If anyone is following this, the use of the TRIM() function eliminated this problem. I'd still like to know the structure of the string as originally returned.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top