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

HOW TO RETRIEVE DATA FROM dB BY SELECTING OPTIONS FROM SELECT BOX

Status
Not open for further replies.

Coding

Programmer
Aug 13, 2000
25
0
0
CA
Does anyone know how to retrieve information from database by selecting options from select box? This code works if I put value=&quot;John&quot; which is of a string type. But when I put value=&quot;<%=rsUserInfo(&quot;usr_firstName&quot;)%>&quot; it gives me type mismatch error. It seems that the JavaScript function recieve only string type but not Recordset object.
I actually need to fit this code to the application which will email the content of the textarea to users. Each user should get his unique information like: name, address, email, username, etc...
Does anyone know how to write function to do this?
Thanks.

function selectItem()
{

document.the_form.the_area.value += &quot; &quot; + <%_%>
the_form.the_selectbox.options[the_form.the_selectbox.selectedIndex].value;

}

...

<form name=&quot;the_form&quot; method=&quot;post&quot; >

<select name=&quot;the_selectbox&quot; onChange=&quot;selectItem();&quot;>

<option value=&quot;<%=rsUserInfo(&quot;usr_firstName&quot;)%>&quot;>First Name
<option value=&quot;<%=rsUserInfo(&quot;usr_lastName&quot;)%>&quot;>Last Name
<option value=&quot;<%=rsUserInfo(&quot;usr_address&quot;)%>&quot;>Address

</select>

<textarea rows=&quot;15&quot; cols=&quot;60&quot; name=&quot;the_area&quot;></textarea>

</form>

...
 
I think you're missing a couple of brackets...
value=&quot;<%=rsUserInfo(&quot;usr_firstName&quot;)%>&quot;

should be

value=&quot;<%=(rsUserInfo(&quot;usr_firstName&quot;))%>&quot; Blood, Sweat But No Tears!
 
Coding,

what are you trying to do here?
[tt]
function selectItem()
{

document.the_form.the_area.value += &quot; &quot; + <%_%>
the_form.the_selectbox.options[the_form.the_selectbox.selectedIndex].value;

}
[/tt]
=========================================================
if (!succeed) try();
-jeff
 
I am trying to get new line by ASP underscore(<%_%>). It is OK. I tested it so it works.


function selectItem()
{

document.the_form.the_area.value += &quot; &quot; + <%_%>
the_form.the_selectbox.options[the_form.the_selectbox.selectedIndex].value;

}
 
why is that necessary? I tested a page with:
[tt]
a<%_%>b
[/tt]
...and the page renders as &quot;ab&quot;...no newline...

anyway, your ASP is going to be processed server-side, so the client-side JS has no idea that you wrote it using a recordset object. I use this method all the time...something else must be wrong, perhaps your one of the records contains a double-quote? =========================================================
if (!succeed) try();
-jeff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top