Results 1 to 9 of 9

Thread: problem getting data using onclick function

  1. #1
    Join Date
    Nov 2007
    Posts
    69
    Thanks
    36
    Thanked 0 Times in 0 Posts

    Default problem getting data using onclick function

    hi forum
    i m facing a problem and m attaching the database and the html file as the code
    i m trying to search records frm ms access database successfully and when the user click on any one of the record searched it should show in the input text field.this is what is not happening
    search record is done successfully but when i try to use onclick function to get the data to input fields it does nothing
    i know there is some error on my part but i m not able to detect it.
    if you guys can point out my mistake it wud be really great
    thanks
    anand
    ps-the relevant functions are

    function getClientDetails(rid) (this function has some error and need to be rectified)

    function getSearchResults()

    smile always

  2. #2
    Join Date
    Jul 2006
    Posts
    497
    Thanks
    8
    Thanked 70 Times in 70 Posts

    Default

    I don't think I can run your code on MySQL (the only DBMS I have), so, for me to help you, you need to post a live URL unless you can give very simple instructions for using your database.
    -- Chris
    informal JavaScript student of Douglas Crockford
    I like wikis - a lot.

  3. #3
    Join Date
    Nov 2007
    Posts
    69
    Thanks
    36
    Thanked 0 Times in 0 Posts

    Default

    hi
    sir i m using ms access as database and all you need to run this code is to have ie5+ and ms access installed
    it is a stand alone application
    thanks
    anand

  4. #4
    Join Date
    Jul 2006
    Posts
    497
    Thanks
    8
    Thanked 70 Times in 70 Posts

    Default

    Umm, yeah and I'm running Linux. Even if I were on Windows, I wouldn't buy Access.

    But I can't help you even if you do post a live example because the makeshift IE I have (ies4linux) crashes my computer (as I just found out last night).
    -- Chris
    informal JavaScript student of Douglas Crockford
    I like wikis - a lot.

  5. #5
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,626
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    I can explain the issue with the help of an example. Assume that I've loaded the page (receive.htm) in IE and entered value 1 in the search box and pressed enter. Now you can view two records. I click on the first column of the first record (row). Now the getClientDetails function will be called and as a parameter to the function a value of 17.

    You are trying to execute the following SQL statement in the getClientDetails function

    Code:
    var SQL = "Select * from receive1 where rid = " + rid;

    In other words you are trying to retrieve a record from the recieve1 table whose rid field's value is 17. If you look at the recieve1 table you can find that there is no such record with the mentioned rid (17).

    Another point in getClientDetails function is

    Code:
    document.getElementById("txtid2").value   = rs("ClId");
    document.getElementById("txttype1").value   = rs("type1");
    document.getElementById("txttype2").value   = rs("type2");
    document.getElementById("txttype3").value   = rs("type3");
    You are using the above code to put the value into text boxes from the recordset object. If you check the receive1 table doesn't contain any of the mentioned fields. So mostly you've used an incorrect table name in your sql statement.

    I think either you pass incorrect value to the getClientDetails function and trying to retrieve record(s) from it which doesn't exists.

    Another point I've noticed is that the table structure and the relationship you have is very very complex and it is really very difficult to understand what you are trying to do. You should have a flexible table structure and relationships then only you'll be able to maintain it efficiently. There is no point in making it complex unless it is complex. If things can be represented in simple manner then go for it.

  6. The Following User Says Thank You to codeexploiter For This Useful Post:

    meenakshi (08-04-2008)

  7. #6
    Join Date
    Nov 2007
    Posts
    69
    Thanks
    36
    Thanked 0 Times in 0 Posts

    Default

    hi codex
    thanks for the explaination
    and yes i was trying to build a simple table but then i came across www.utteraccess.com
    and there they explained the more detailed and complex the database is it is easier to run it in real time and so i switched over to this complex structure and that is the main reason for the problem
    you are true abt the fields but i think now i can explain you what i m trying to do
    1.i want to leave rid as empty and want to transfer the clid value to id2 so as to link the two tables in the database
    2.type1,type2,type3 are not in the receive table but i just want to get that on the input table to make sure the person entrying the record does not make any mistake,i mean like the record states as below
    tailoring no-1200,
    pcs=1 type1=shirt,
    pcs=1 type2=coat
    pcs=4 type3=trouser
    so entring it will have no confusion if i m able to make the type1,type2,type3,show in input field eventhough i wont save it in the receive.. see the saveform() function
    that is where im not able to do the right coding
    pls suggest if you feel like there is something i sud change to make it happen
    thanks
    anand
    smile always

  8. #7
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,626
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    When you design database for your application firstly it should be in such a way that it is completely suitable for you. Sometimes you have to sacrifice some of the theoretical aspect of (R)DBMS for the sake of practical efficiency.

    It would be better if you explain the nature of your application and see whether the database design can be improved.

    Some users tend to create complex database just for the sake of applying all the database principles, which I think is not necessary all the time.

    Plz provide your requirements and the so that other members can also contribute to your problems and you can select the best solution.

  9. The Following User Says Thank You to codeexploiter For This Useful Post:

    meenakshi (08-05-2008)

  10. #8
    Join Date
    Nov 2007
    Posts
    69
    Thanks
    36
    Thanked 0 Times in 0 Posts

    Default

    hi codex
    thanks a lot for the reply
    well i m designing a tailoring software which undergoes a lot of processes and the front end in javascript and backend database is ms access
    and i have fully understood what you mean to say abt the database
    i will do the needful and implement all the things with better results
    thanks
    anand

  11. #9
    Join Date
    Nov 2007
    Posts
    69
    Thanks
    36
    Thanked 0 Times in 0 Posts

    Default

    hi codex
    is there a way to transfer the clid value to id2 in input field? from the searched data ,

    this is all i want and the rid value remains empty in receive1
    pls advice
    thanks
    anand

Bookmarks

Posting Permissions

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