Filling HTML form field from DB field

Jim Ford

New Member
I am using a DB field to pre-fill an HTML form field. The DB field is "cust-name" and cust-name = "Mike Smith". A portion of the Webspeed code for the form data cell is:
{&OUT}
"<td><input type=text name=cust-name size=30 value=" cust-name "></td>".
When Webspeed displays the form only "Mike" is displayed in the field. What do I need to do to get the form field to display the complete field "Mike Smith" and display both words? I assume there is a problem with the space between Mike and Smith. jaf
 
Try this:
Code:
{&OUT}
 "<td><input type=~"text~" name=~"cust-name~" size=30 value=~""  cust-name  "~"></td>".
OR

Code:
 {&OUT}
  '<td><input type="text" name="cust-name" size="30" value="'  cust-name  '"></td>'.
OR (my personal faviorite, because the data type of the variable or field does not have to be a character data type.).

Code:
  {&OUT}
   substitute('<td><input type="text" name="cust-name" size="30" value="&1"></td>', cust-name).
The problem is the attribute value is not quoted. Simple.
 
Also it might pay to process each variable/field outputted through the WebSpeed "html-encode" function.

Code:
dev var cMessage as character.

ASSIGN cMessage  = ' "Openedge" > "Oracle" & "Windows" < "Lnux" '.

{&OUT} substitute('<h1>&1</h1>', html-encode(cMessage)) skip.
The generated result should come out like this:

&quot;Openedge&quot; &gt; &quot;Oracle&quot; &amp; &quot;Windows&quot; &lt; &quot;Lnux&quot;

Hope this helps.
 
Back
Top