insertAdjacentHTML Questions... 
Author Message
 insertAdjacentHTML Questions...

What im trying to do is, when a user changes a select box on the page, i
run a remote scriping script, and i want
to insert the values into another select box, only i cant figure it out.
Where am i going wrong?
My Remote Scripting is in VBScript and works great.

<Form action="NoActualRev.as" Method=Post Id=frm Name=frm>
<Table>
<tr>
<td>
 <Select name="SalesTeamID" onChange="ListUsers()"
style="width:260;height:25">
        <%

         If Session.Contents.Item("Access") = 1 then
            Do While Not oRec.EOF
               Response.Write "<option value="&
Trim(oRec.Fields.Item("SalesTeamID")) & ">" &
oRec.Fields.Item("Description")
               oRec.MoveNext
            Loop
         Else
            Do While Not oRec.EOF
               If Trim(oRec.Fields.Item("SalesTeamID")) =
Trim(Session.Contents.Item("SalesTeamID")) Then
                 Response.Write "<option value="&
Trim(oRec.Fields.Item("SalesTeamID")) & ">" &
oRec.Fields.Item("Description")
               End If
                   oRec.MoveNext
            Loop            
         End If
%>

 </Select>
</td>
</tr>
<tr>
<td>
<!-- Ive messed with so much im not sure what need a id or not =( -->
 <Span ID=UserID>
 <Select Id=User name="User" style="width:260;height:25">
 </Span>
</td>
</tr>
<tr>
<td>
<Input type=button name=btnListUsers value="List Users"
onclick="ListUsers()" style="width:250;height:25">
</td>
</tr>
</table>
</Form>

<SCRIPT LANGUAGE="javascript">

var serverURL = "FillSelectWithUsers.asp";

function ListUsers(){

        var co = RSExecute(serverURL,"GetUsers");
        myCallBack(co);

Quote:
}

function myCallBack(co){
    //alert(co.return_value);

   //This is my problem, my return_ value is a string of "<option
value="bla">What i want"<option value="bla2">another thing i want"
 // How do i get this to insert into the select box??????

    document.body.frm.UserID.insertAdjacentHTML = co.return_value;

Quote:
}

</Script>


Sun, 21 Apr 2002 03:00:00 GMT  
 insertAdjacentHTML Questions...
howdy--

I would concatenate the select element in with the option you're getting from the RSExec, then:

UserID.innerHTML=
    "<Select Id=User name='User' style='width:260;height:25'>"+co.return_value+"</select>"

T

--
T-Man is Scott Thode
Currently: under-employed
Recent personal projects:
http://www.fn.net/~whytdred/

Quote:

> What im trying to do is, when a user changes a select box on the page, i
> run a remote scriping script, and i want
> to insert the values into another select box, only i cant figure it out.
> Where am i going wrong?
> My Remote Scripting is in VBScript and works great.

> <Form action="NoActualRev.as" Method=Post Id=frm Name=frm>
> <Table>
> <tr>
> <td>
>  <Select name="SalesTeamID" onChange="ListUsers()"
> style="width:260;height:25">
>         <%

>          If Session.Contents.Item("Access") = 1 then
>             Do While Not oRec.EOF
>                Response.Write "<option value="&
> Trim(oRec.Fields.Item("SalesTeamID")) & ">" &
> oRec.Fields.Item("Description")
>                oRec.MoveNext
>             Loop
>          Else
>             Do While Not oRec.EOF
>                If Trim(oRec.Fields.Item("SalesTeamID")) =
> Trim(Session.Contents.Item("SalesTeamID")) Then
>                  Response.Write "<option value="&
> Trim(oRec.Fields.Item("SalesTeamID")) & ">" &
> oRec.Fields.Item("Description")
>                End If
>                    oRec.MoveNext
>             Loop
>          End If
> %>

>  </Select>
> </td>
> </tr>
> <tr>
> <td>
> <!-- Ive messed with so much im not sure what need a id or not =( -->
>  <Span ID=UserID>
>  <Select Id=User name="User" style="width:260;height:25">
>  </Span>
> </td>
> </tr>
> <tr>
> <td>
> <Input type=button name=btnListUsers value="List Users"
> onclick="ListUsers()" style="width:250;height:25">
> </td>
> </tr>
> </table>
> </Form>

> <SCRIPT LANGUAGE="javascript">

> var serverURL = "FillSelectWithUsers.asp";

> function ListUsers(){

> var co = RSExecute(serverURL,"GetUsers");
> myCallBack(co);

> }

> function myCallBack(co){
>     file://alert(co.return_value);

>    file://This is my problem, my return_ value is a string of "<option
> value="bla">What i want"<option value="bla2">another thing i want"
>  // How do i get this to insert into the select box??????

>     document.body.frm.UserID.insertAdjacentHTML = co.return_value;

> }

> </Script>



Sun, 21 Apr 2002 03:00:00 GMT  
 insertAdjacentHTML Questions...
Hi William,
if you want to use javascript, I've got a number of scripts that swap values
from one select list to another.
My site is http://members.aol.com/grassblad

Vinny



Tue, 23 Apr 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. write script into another frame with innerHTML/insertAdjacentHTML

2. insertAdjacentHTML and removeChild

3. HELP: InsertAdjacentHTML Problem

4. insertadjacenthtml of object to trigger autodownload...

5. insertAdjacentHTML Method

6. insertAdjacentHTML

7. Invalid target element for this operation / insertAdjacentHTML

8. Cross Browser insertAdjacentHTML() ??

9. using asp var in "insertAdjacentHtml"

10. Frame movement question and tree view question

11. Newbie question: Session_OnEnd question

12. HTA Question and GetObject Question

 

 
Powered by phpBB® Forum Software