onSelect JS

Hello,

Its easy but seems to be difficult for me. Initial dropdown of 'Product' and 'Version' should be deactive. Now I have Form Field 'Family' which has dropdown list, onSelect  cooresponding family, a 'Product' list should display in 2nd dropdown list and onSelect correspoiding Product, 'version' list should display in 3rd dropdown.

------My Form-----
Family :: <dropdown list>
Product :: <dropdown list>
Version ::  <dropdown list>
 [submit][reset]
-----------------------

Using a Stored Procedure I can able to display list of Family, when user select any one from list of dropdown in Family I'll be passing that variable name to 2nd stored procedure and will be getting list of product and similary the version. Now when I select a family it will be passed to some JS, how should pass that JS variable to a JSP  ?

Sample code would be great !!

Thanks for your time.



princehyderabadAsked:
Who is Participating?
 
archrajanCommented:
You have to research it with

1)iframes
2)XMLHTTP
0
 
archrajanCommented:
check all the links there, and also answers of ldbkutty!

And here in this link: some more ideas to make it work with back end
http://www.experts-exchange.com/Web/Web_Languages/JavaScript/Q_21257564.html
http://www.experts-exchange.com/Web/Web_Languages/JavaScript/Q_21263336.html

0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
princehyderabadAuthor Commented:
LInks are good no doubt.

Q1. Instead of Servlet we can using JSP too rite ?

Q2. But my idea was instead of calling or send to servlet and servlet redirecting/depatching back and forth. Dont we have any better way to keep it in single page wihout moving back and forth.



0
 
princehyderabadAuthor Commented:
any Sample Code or link.

Currently I'm doing JSP -> JSP - JSP. Sometime it is getting a bit delay. Will your iframes or XMLHTTP make it faster or it may be of same speed
0
 
haobaba1Commented:
do a google on xmlHttpRequest it is supported by most browsers and isn't that difficult to understand or implement.

//This function returns a new httprequest object
function getNewHttpRequest(req)
{
    if (window.XMLHttpRequest)
    {
        req = new XMLHttpRequest();

    }
    else if (window.ActiveXObject)
    {
        req = new ActiveXObject("MSXML2.XMLHTTP.3.0");
      }
      return req;
}


function processResponse(req)
{
      // only if req shows "loaded"
    if (req.readyState == 4) {
        // only if "OK"
        if (req.status == 200) {
            var xmlDom=req.responseXML;
                  var mesg= xmlDom.getElementsByTagName('mesg')[0];
                  if(mesg != null)
                  {
                        var txt=mesg.getAttribute('text');
                        setMessage('message','mtext',txt);
                  }
                  else
                  {
                        setMessage('message','mtext','The Servers Response could not be read (format unknown)');
                  }
        } else {
            alert("There was a problem retrieving the XML data:\n" +
                req.statusText);
        }
    }
}


function SendQuickInquiry()
{
      var com= document.getElementById('comment');
      var txt= com.value;
      if(txt != null && txt != '')
      {
            var req = getNewHttpRequest(req);
            var url=baseURL.concat('inquiry/QuickInquiry?comment=').concat(txt);
            var func= function(){ processResponse(req);}
            getURL(url,func,req);
      }
      else
      {
            setMessage('message','mtext','You must enter a comment');
      }

      return false;
}
0
 
Andrew BeersTechnology LeadCommented:
No comment has been added to this question in more than 21 days, so it is now classified as abandoned..
I will leave the following recommendation for this question in the Cleanup topic area:

http:Q_21401698.html --> Split haobaba1(Accept this as solution) and archrajan

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

~Aqua
EE Cleanup Volunteer
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.