Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #11 (permalink)  
Old August 9th, 2005, 12:16 PM
Friend of Wrox
 
Join Date: Oct 2004
Location: delhi, delhi, India.
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

Hii Rupen !!
No probs
Hope this will help you


<script>
var req;
function blr()
{
url="http://myurl_ip/vinodR&D/optionvalue.html"
    req = false;
    // branch for native XMLHttpRequest object
    if(window.XMLHttpRequest) {
        alert("hii")
        try {
            req = new XMLHttpRequest();
        } catch(e) {
            req = false;
        }
    // branch for IE/Windows ActiveX version
    } else if(window.ActiveXObject) {
        try {
            req = new ActiveXObject("Msxml2.XMLHTTP");
        } catch(e) {
            try {
                req = new ActiveXObject("Microsoft.XMLHTTP");
            } catch(e) {
                req = false;
            }
        }
    }
    if(req) {
        req.onreadystatechange = processReqChange;
        req.open("GET", url, true);
        req.send();
    }
}


function processReqChange()
{

    if (req.readyState == 4) {


        if (req.status == 200) {


                    var xmlDOM = new ActiveXObject("Microsoft.XMLDOM");
                        xmlDOM.loadXML(req.ResponseText);

                        var oNode = xmlDOM.documentElement.firstChild;

                        var n=0;
                        selectedvalue=document.myform.myid.value
                        var outputstr
                        outputstr=""
                        if(oNode != null)
                        {

                                    while (oNode != null)
                                    {
                                        if(selectedvalue==n)
                                        {
                                        outputstr=oNode.text
                                        break;
                                        }
                                        oNode = oNode.nextSibling;
                                        n++;
                                    }

                            } var obj
                                                                            parentobj=document.getElementById("myselbox")

                                                                            objarr=outputstr.split("|")

                                                                            for(i=0;i<objarr.length;i++)
                                                                            {

                                                                            chld=objarr[i].split("~")
                                                                            myname=chld[0];
                                                                            myvalue=chld[1];
                                                                            obj=new Option(myname,myvalue)
                                                                            parentobj[i]=obj
                                                                            }
            }
    }
}
</script>
<body onload="blr()">

<form name="myform">

Select Your Choice<select id="myid" name="myid" onchange="blr()">
<option value="1">AllRecord With 1</option>
<option value="2">AllRecord With 2</option>
<option value="3">AllRecord With 3</option>
<option value="4">AllRecord With 4</option>
</select>
<br>
Dynamic Select Box<select id="myselbox" name="myselbox">
</select>


</form>

</body>


<response>
<option1>Name1~1|Name2~2|Name3~3|Name4~4|Name5~5|N ame6~6|Name7~7|Name8~8|Name9~9|Name10~10|Name11~11 </option1>
<option1>Vinod1~1|Vinod2~2|Vinod3~3|Vinod4~4|Vinod 5~5|Vinod6~6|Vinod7~7|Vinod8~8|Vinod9~9|Vinod10~10 |Vinod11~11</option1>
<option1>Rupen1~1|Rupen2~2|Rupen3~3|Rupen4~4|Rupen 5~5|Rupen6~6|Rupen7~7|Rupen8~8|Rupen9~9|Rupen10~10 |Rupen11~11</option1>
<option1>Hello1~1|Hello2~2|Hello3~3|Hello4~4|Hello 5~5|Hello6~6|Hello7~7|Hello8~8|Hello9~9|Hello10~10 |Hello11~11</option1>
<option1>Vijay1~1|Vijay2~2|Vijay3~3|Vijay4~4|Vijay 5~5|Vijay6~6|Vijay7~7|Vijay8~8|Vijay9~9|Vijay10~10 |Vijay11~11</option1>

</response>

**********optionvalue.html End **********

Note:-
1>Please change ur url as per ur requirement.
2>You can enhance ur code by getting only those rows for which u r selecting values
I mean you can avoid to loop
if(selectedvalue==n)
                                        {
                                        outputstr=oNode.text
                                        break;
                                        }
by making ensure that the row returned by ur optionvalue.html/asp/php/jsp whtever is returning is the ur option value.
Here i used all the combinations so that I donót have to write the asp code
2>Same techniq u can use with hidden frames :)



Cheers :)

vinod

Cheers :)

vinod
Reply With Quote
  #12 (permalink)  
Old August 12th, 2005, 08:33 AM
Registered User
Points: 1,897, Level: 17
Points: 1,897, Level: 17 Points: 1,897, Level: 17 Points: 1,897, Level: 17
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2005
Location: Mumbai, Maharastra, India.
Posts: 352
Thanks: 14
Thanked 0 Times in 0 Posts
Send a message via Yahoo to rupen
Default

HI Vinod,

After investigating a bit, i found that u r using xml to retrive data,
but how it will be dynamic???
since, http://myurl_ip/vinodR&D/optionvalue.html is html page.
and the url points to server side file?

Pls guide.


Rupen Anjaria.:)
------------------
We CAN'T avoid problems, but can solve it.
Reply With Quote
  #13 (permalink)  
Old August 12th, 2005, 09:24 AM
Friend of Wrox
 
Join Date: Oct 2004
Location: delhi, delhi, India.
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

Hi Rupen!!
 Thats great Offcourse You can make it asp/jsp/php whtever page.I already have implemented in my company projects
but the format should be like this only.
Or you have to manipulate that code(if it contails javascript,or html tags)
Hope this will help you



Cheers :)

vinod
Reply With Quote
  #14 (permalink)  
Old August 12th, 2005, 10:26 AM
Registered User
Points: 1,897, Level: 17
Points: 1,897, Level: 17 Points: 1,897, Level: 17 Points: 1,897, Level: 17
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2005
Location: Mumbai, Maharastra, India.
Posts: 352
Thanks: 14
Thanked 0 Times in 0 Posts
Send a message via Yahoo to rupen
Default

HI Vinod,
Okay, say i m using ASP to code that url page.
then what to put in <response>...</response>? as it is dependent on the selection of previous combo.
HUUUh m getting confu ....!!
Further i have put these two file on my desktop and tried to execute but nothing comes out!!
value dosn't fill in combobox.

Please....help me.

Rupen Anjaria.:)
------------------
We CAN'T avoid problems, but can solve it.
Reply With Quote
  #15 (permalink)  
Old August 12th, 2005, 10:51 AM
Registered User
Points: 1,897, Level: 17
Points: 1,897, Level: 17 Points: 1,897, Level: 17 Points: 1,897, Level: 17
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2005
Location: Mumbai, Maharastra, India.
Posts: 352
Thanks: 14
Thanked 0 Times in 0 Posts
Send a message via Yahoo to rupen
Default

HI Vinod,

It is working while commenting "if (req.status == 200)".Can u elaborate what this condition is for?

Further,
1) it is just like i have to prefill value with contents in separate file,
and have to call from this code, is it?

2)<option1> has to be 1 always?

3)I have around 5 combobox which are inter linked. what precaution should i take?

I think i m very near to solution. Thanks


Rupen Anjaria.:)
------------------
We CAN'T avoid problems, but can solve it.
Reply With Quote
  #16 (permalink)  
Old August 12th, 2005, 11:17 AM
Friend of Wrox
 
Join Date: Oct 2004
Location: delhi, delhi, India.
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

Hii Rupen!!
1)YOu need ur iis or personal web server or apache(for php),tomcat(jsp) or any other web
server,so that your http request can be sent to required (php,asp,jsp..) page.
2)Status=200
plz visit
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
3))<option1> has to be 1 always? its upto ur requirement.
Can u eleborate ur requirement and set it to my yahooid with same username
4)NO problems if you have 5 combox ,its upto ur reqmnt

Yes you are very close to solution and i do think we can solve it!!




Cheers :)

vinod
Reply With Quote
  #17 (permalink)  
Old October 10th, 2005, 09:48 AM
Friend of Wrox
 
Join Date: Oct 2004
Location: delhi, delhi, India.
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

http://p2p.wrox.com/topic.asp?TOPIC_ID=35481

Cheers :)

vinod
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Populating dropdown within a datagrid ninel ASP.NET 2.0 Professional 2 May 31st, 2006 02:41 AM
Populating dropdown within a datagrid ninel ASP.NET 2.0 Basics 7 May 26th, 2006 03:26 PM
Populating dropdown within a datagrid ninel General .NET 0 May 26th, 2006 12:27 PM
populating a dropdown list with values from datab akshay144 VS.NET 2002/2003 5 May 12th, 2006 10:15 AM



All times are GMT -4. The time now is 08:56 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.