42 users online (0 members and 42 guests)  


  Results 1 to 12 of 12

Related

  1. two drop down menus    Forum: Website Scripts Forum
    Replies: 10
  2. drop down menu prob.    Forum: HTML Forum
    Replies: 3
  3. Drop Down Menus    Forum: HTML Forum
    Replies: 6
  4. Drop Down Menus    Forum: HTML Forum
    Replies: 1
  5. Drop down menus    Forum: HTML Forum
    Replies: 0
  1. #1
    bdimi's Avatar
    New User

    Status
    Offline
    Join Date
    Oct 2003
    Posts
    12

    javascript drop down menus prob

    Hi,
    i have a problem with the following code...i am using procedure builder (oracle) and i keep getting the message: the source code is incomplete. I know that the problem is somewhere within javascript but i dont know anything about that language so i cant find whats wrong...please help me!!

    PROCEDURE forms AS

    cursor ctype
    is
    select distinct mem_type from war_membr;

    sel1 varchar2(30);
    --
    BEGIN
    --
    htp.print('<HTML>');
    htp.print('<HEAD>');
    htp.print('<TITLE>buttons</TITLE>');
    htp.print('<SCRIPT LANGUAGE="JavaScript">
    var Stained_Glass_WindowArray = new Array("Eldwick", "Windhill", "West Bowling");
    var Foundation_StoneArray = new Array("Esholt");
    var PlaqueArray = new Array("Esholt");
    var Framed_PhotographArray = new Array("Esholt");
    var StatueArray = new Array("Steeton");

    function updateList(theForm, catName, subjListLength) {
    for (var i=subjListLength + 1 ; i > 0 ; i-- )
    {
    theForm.Subject.options[i] = null;
    }
    if( catName == "None") {
    var option0 = new Option("- Please Choose a Category Above -", "None");
    }
    else{
    eval('var option0 = new Option("- Please Choose -", "None")');
    }

    NSL=0;
    if (catName != "None") {
    eval("var NewSource = " + catName +"Array");
    NSL = NewSource.length;
    for(var L = 0; L < NSL + 1; L++) {
    eval("var option" + [L + 1] + " = new Option(" + '"' + NewSource[L] + '", "' + NewSource[L] + '")');
    }
    }
    for (var i=0; i < NSL + 1; i++) {
    eval("theForm.Subject.options[i]=option" + i);
    if (i==0) {
    theForm.Subject.options[i].selected=true;
    }
    }
    if (browser_type=="Netscape")
    { history.go(0) }
    }
    </script>');

    htp.print('</HEAD>');
    htp.print('<BODY BGCOLOR="#99CCCC">');


    htp.print('<div align="center">');
    htp.print('<FORM NAME="Memorial_type" onChange="updateList(this.form, this.options[selectedIndex].value, this.form.Subject.length)" METHOD="post" >');
    htp.print('<SELECT name="v_sel">');

    for sel_t in ctype loop
    htp.print('<option value="'||sel_t.mem_type||'">'||sel_t.mem_type||'</option>');
    end loop;
    htp.print('</SELECT>');
    htp.print('<INPUT TYPE="submit" value="submit">');
    htp.print('</FORM>');
    htp.print('</div>');
    --
    htp.print('<div align="center">');
    htp.print('<FORM NAME="Memorial_type" ACTION="'||f_host||'search1" METHOD="post" >');
    htp.print('<input type="text" name="sel1" size="30" value="">');
    htp.print('<INPUT TYPE="submit" value="click me">');
    htp.print('</div>');
    htp.print('</form>');

    --
    htp.print('</BODY>');
    htp.print('</HTML>');
    commit;
    end;

  2. #2
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Hi there,

    Whilst I have never used procedure builder (didn't know you could do this with oracle, gonna have to convince my employer to purchase it ) I am guessing it might be this line -

    Code:
    eval('var option0 = new Option("- Please Choose -", "None")');
    As it uses the ' delimiter, its possible that it thinks this is the end of the htp.print started here -

    Code:
    htp.print('<SCRIPT LANGUAGE="JavaScript">
    My suggestion is to escape the ' symbol(s) within the JavaScript code.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  3. #3
    bdimi's Avatar
    New User

    Status
    Offline
    Join Date
    Oct 2003
    Posts
    12
    thnx, but could u suggest something?? I am new in programming and i didnt make the script. I just altered the arrays to fit mine.... Could u please tell me if there is a possibility to change the code and use a cursor to sellect the options for each array??? What i mean is...what happens if the amount of data is rather large, and so its difficult to manually identify all the options for each group???

  4. #4
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    sorry, could you explain that a little more?
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  5. #5
    bdimi's Avatar
    New User

    Status
    Offline
    Join Date
    Oct 2003
    Posts
    12
    well sorry!!
    First of all i dont know what to do to avoid the 'symbols...could you suggest something??? I dont know anything about javascript and i am also new to plsql !!

    Secondly, i have these arrays:

    var Stained_Glass_WindowArray = new Array("Eldwick", "Windhill", "West Bowling");
    var Foundation_StoneArray = new Array("Esholt");
    var PlaqueArray = new Array("Esholt");
    var Framed_PhotographArray = new Array("Esholt");
    var StatueArray = new Array("Steeton");

    the truth is that i have many categories like Stained Glass Window and many more places like Eldwick that have to be put in the code. In order to create tha arrays myself i will have to check a long list of categories and places where these categories may be found. Is there a more quick way to do that??? (something similar to a cursor?? or with javascript there is no capability of searching through a table??)

    thnx!!!

  6. #6
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    You escape in javascript with the \ character. I do not know plsql either, but a quick google seemed to indicate the same . So make the ' character in that line \' instead and see if it works.

    Your array could be stored in the database, I would have thought? with the categories in there, it would be easier than storing it all in a JavaScript array.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  7. #7
    bdimi's Avatar
    New User

    Status
    Offline
    Join Date
    Oct 2003
    Posts
    12
    well, i still get an error message...encountered the symbol ''VAR'' when expecting one of the following....(),*@ etc.... it is certain that this is the line with the problem...can u think of something else????
    thnx!!

  8. #8
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Is this error from psql or from JavaScript? (JS errors are at the bottom of your browser)
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  9. #9
    bdimi's Avatar
    New User

    Status
    Offline
    Join Date
    Oct 2003
    Posts
    12
    from plsql...

  10. #10
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    I'm pretty stuck then, sorry. Hopefully one of our other members has more experience with this software.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  11. #11
    bdimi's Avatar
    New User

    Status
    Offline
    Join Date
    Oct 2003
    Posts
    12
    hi again...i ve fixed the plsql problem but now i have another, javascript related obviously!! could you please chech it out ?? \
    my web page is: http://tiger.iso.port.ac.uk:7778/pls/www/geg20156.memorial.home , you have to cluck the "find a memorial" link.
    i get a runtime error each time i choose a category at the first drop down menu...(web browser undefined...).
    thnx a lot!

  12. #12
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Remove this chunk -
    Code:
    if (browser_type=="Netscape")
              { history.go(0);
    
              }
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?



Tags for this Thread