?
Solved

error in return code

Posted on 1999-01-13
7
Medium Priority
?
159 Views
Last Modified: 2010-04-09
when this line is ran it quits after the space in the item being returned(cursor.AGNT_ADDRESS).  so if "Billings Street" is in the  database "Billings" is the only thing printed in the box.  any ideas ??
TIA
 
    <SERVER>
    write("<TD WIDTH=240><INPUT id=FormsEditField2 TYPE=text NAME=address1 VALUE="+escape(cursor.AGNT_ADDRESS)+"
    SIZE=30 MAXLENGTH=30></TD>");
    </SERVER>
0
Comment
Question by:craigs052998
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 

Expert Comment

by:MagicJ
ID: 1841657

    <SERVER>
    write("<TD WIDTH=240><INPUT id=FormsEditField2 TYPE=text NAME=address1 VALUE='" + cursor.AGNT_ADDRESS + "'
    SIZE=30 MAXLENGTH=30></TD>");
    </SERVER>
escape() function will just replace all the occurences of special chars by it's Hex equivalent. In the text box u don't want a hex char to be seen. Try putting a single quote before and after the string as shown above and let me know.

Best of Luck
0
 
LVL 3

Accepted Solution

by:
idt earned 200 total points
ID: 1841658
Craigs,

when your line is send to the browser, it reads

<TD WIDTH=240><INPUT id=FormsEditField2 TYPE=text NAME=address1 VALUE=Billings Street SIZE=30 MAXLENGTH=30></TD>

So.. the browser interprets Street as a new argument that it doesn't know, so ignores it

The 'trick is to surround your info with quotes, the easiest is single quotes:

write("<TD WIDTH=240><INPUT id=FormsEditField2 TYPE=text NAME=address1 VALUE="+"'"+cursor.AGNT_ADDRESS+"'"+" SIZE=30 MAXLENGTH=30></TD>");

Then the browser will recieve
<TD WIDTH=240><INPUT id=FormsEditField2 TYPE=text NAME=address1 VALUE='Billings Street' SIZE=30 MAXLENGTH=30></TD>

you may also try ...VALUE="+'"'+curs... to surround the data with double quotes, but such code does not work in all server environments

-iDT
"God is real, unless specifically defined as an integer"
0
 
LVL 3

Expert Comment

by:idt
ID: 1841659
The E.E. server does some quote stripping of its own..
the line of code I sent should read:

.address1 VALUE=" + " <singlequotehere> "+cursor.AGNT_ADDRESS + " <singlequotehere> " + " SIZE=30 ...

I hope that's legible.. :)

-iDT
0
WordPress Tutorial 2: Terminology

An important part of learning any new piece of software is understanding the terminology it uses. Thankfully WordPress uses fairly simple names for everything that make it easy to start using the software.

 

Author Comment

by:craigs052998
ID: 1841660
adding the single quote did it
0
 

Expert Comment

by:MagicJ
ID: 1841661
Hi Craigs,

This is very unfair, I send u the same answer and u accepted idt's answer. Please read my comment if u have time to do so.

Best Of Luck...
0
 

Author Comment

by:craigs052998
ID: 1841662
I went with who answered it first not as a comment.  In the past I had problems with people taking one persons comment and answering it as theirs.  So I give the points to the first one to answer it, not comment it, and have to refuse and reopen the the first one that did it as a comment.  That sounded confusing but I think you got the idea.

And yes yours did the same thing
0
 
LVL 3

Expert Comment

by:idt
ID: 1841663
Sorry MagicJ, when I read your comment I really thought you misunderstood his question and thought the escape() function contributed to his problem.

I know it is frustrating when an answer seems to be posted as an end run.

regards
-iDT
0

Featured Post

WordPress Tutorial 4: Recommended Plugins

Now that you have WordPress installed, understand the interface, and know how to install new parts, let’s take a look at our recommended plugins.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question