SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Search Page

  1. #1
    SitePoint Evangelist lance_vincent's Avatar
    Join Date
    Aug 2004
    Location
    philippines
    Posts
    574
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Search Page

    ei folks!

    i have this products table on my database, and usually, i use them in a form of select box on my application. but the number of products has grown rapidly, so i will be needing a different approach.

    there is this textbox with a test link besides it. when clicked, it opens up a small window, where you can search for products, then when the result is generated, i could click on the link, and the page closes, and the value will be passed on my parent windows textbox. many system has been using this approach, but i cant google the right words for this.please help.

    and to complicate things a bit, i want a textbox and a hidden field, the textbox would contain the words, and the hidden field would contain the id of the product.

    if you have link i could read on this or a good exampl, it will help a lot!

    Thanks!
    If you won't dress like the
    Victoria Secret girls,
    don't expect us to act like soap opera guys.

  2. #2
    SitePoint Wizard
    Join Date
    Mar 2001
    Posts
    3,537
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it opens up a small window, where you can search for products,
    javascript can't access a database. js can only request a page on the server, but the page on the server can contain code(php, java, etc.) that searches a database and then returns the results.

    The other stuff: clicking on a link, opening a popup, transferring a value from a popup, then closing the popup is pretty straight forward js.

    clicking on a link-->onclick="someFunc()"

    opening a popup: function someFunc(){var popup = window.open(...);};

    The popup can access any function or html element on the main page by preceding the name of the function or element by "opener", e.g.:
    Code:
    opener.setVal();
    or
    opener.document.getElementById("hiddenID").value = result;
    And the main page can access anything in the popup using the reference to the popup returned by window.open(), e.g.
    Code:
    var popup = window.open(.........);
    popup.getElementById("elmtID");

  3. #3
    SitePoint Evangelist lance_vincent's Avatar
    Join Date
    Aug 2004
    Location
    philippines
    Posts
    574
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes yes this is just the piece of code i was looking for

    opener.setVal();
    or
    opener.document.getElementById("hiddenID").value = result;

    thanks a lot!
    If you won't dress like the
    Victoria Secret girls,
    don't expect us to act like soap opera guys.


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
  •