DBAsupport.com Forums - Powered by vBulletin
Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: plsql, html and javascript problem

  1. #1
    Join Date
    Nov 2003
    Posts
    10

    plsql, html and javascript problem

    Hi,
    I have created a web site connected to a database table... I have used the following script to connect two drop down menus but it doesnt work...i get an error at line :
    eval('var option0 = new Option("- Please Choose -", "None")');
    i am using procedure builder and i get a pls-00103 error. Encountered the symbol '"var"' when expected ....
    could somebody understand why???

    the attached file contains the code...

    thnx!!
    Attached Files Attached Files

  2. #2
    Join Date
    Apr 2001
    Location
    Czechia
    Posts
    712
    Hi,
    all the javascript code is inside a PL/SQL string eclosed by apostrophes. If you want to use an apostroph inside the string, you have to double it:
    eval(''var option0 = new Option("- Please Choose -", "None")'');
    Ales
    The whole difference between a little boy and an adult man is the price of toys

  3. #3
    Join Date
    Nov 2003
    Posts
    10
    well thnx, i did that and now i have no errors...it doesn t work though...do you think u could check it please???? I am really new to this and i cant find the mistake myself...:(

    thnx again
    Attached Files Attached Files

  4. #4
    Join Date
    Apr 2001
    Location
    Czechia
    Posts
    712
    No errors?
    I got "PLS-00201: identifier 'F_HOST' must be declared". I changed F_HOST to a string and then it compiled. Then I created the table war_membr, inserted "111" into column mem_type. After that I got a form and I attach the screenshot.

    What do you mean by "doesn't work" ?
    Attached Images Attached Images
    Ales
    The whole difference between a little boy and an adult man is the price of toys

  5. #5
    Join Date
    Nov 2003
    Posts
    10
    well, first of all this is the procedure as currently used (attached)...
    I have declared the host identifier in my package body thats why i dont get any errors like that. the thing is that i get a runtime error when i choose a category. my web site is: http://tiger.iso.port.ac.uk:7778/pls....memorial.home

    u have to click on "find a memorial" to see it.

    In addition, i m thinking that in my table the mem_type are written with spaces (ex. Stained Glass Window instead of Stained_Glass_Window as it appears in the javascript). But even when i tried the code only with the commented part (as u can see in the file) still it didnt work...hope this makes sense...
    thnx
    Attached Files Attached Files

  6. #6
    Join Date
    Apr 2001
    Location
    Czechia
    Posts
    712
    There was syntax error - right parenthesis missing:
    Code:
    eval("var option" + [L + 1] + " = new Option(" + ''"'' + NewSource[L] + ''", "'' + NewSource[L] + ''")'');
    You could use replace to get proper array names:
    Code:
    htp.print('<option value="'||replace(sel_t.mem_type,' ','_')||'">'||sel_t.mem_type||'</option>');
    Ales
    The whole difference between a little boy and an adult man is the price of toys

  7. #7
    Join Date
    Aug 2002
    Posts
    115
    Try this out..

    you might get expected results for plague and statue..but not for the rest...as the rest have array names as Stained_Glass_WindowArray,Foundation_StoneArray etc...with "UNDERSCORES" replacing "BLANK SPACES"..
    Attached Files Attached Files

  8. #8
    Join Date
    Nov 2003
    Posts
    10
    well, i did what u told me and it almost works...! could you check it out once more please?? i get a new runtime error about the browser type (says it is undefined)
    thnx again for your valuable help!!!

  9. #9
    Join Date
    Nov 2003
    Posts
    10
    in addition, even if i put another option at the second drop down menu, and select that, the action does not work...(but if i don t use the first drop down at all it works fine!!) does it need to be handled in a different way when the first drop down is used as well or is it the runtime error that produces the problem...??
    thnx

  10. #10
    Join Date
    Apr 2001
    Location
    Czechia
    Posts
    712
    This is javascript related issue and I don't use javascript at all. I'm sorry.
    If you want to debug a web page with javascript, save the page as .html file, modify the file and open it in the browser. After every change in the .html file just refresh the browser to see result.
    Ales
    The whole difference between a little boy and an adult man is the price of toys

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width