Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 4 123 ... LastLast
Results 1 to 15 of 52
  1. #1
    Regular Coder
    Join Date
    Dec 2003
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Is It Possible To Enter A Term In A Text Field, Hit A Button, & Have That Text...

    Is It Possible To Enter A Term In A Text Field, Hit A Button, & Have That Text Populate The Text Fields In Other Forms...???

  • #2
    New Coder
    Join Date
    Jul 2002
    Location
    Los Angeles
    Posts
    89
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You can use the script I developed for this post:
    http://www.codingforums.com/showthre...threadid=18868

  • #3
    Regular Coder
    Join Date
    Dec 2003
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy More Info, Please...

    Thanks for replying...

    Let me be more clear on what I would like to accomplish (if doable)...

    I would like to do something similar to a form that populates the same fields in "Shipping Address" as in "Billing Address"...

    However, here is what I would like to do:

    All On One Page"


    SEARCH: |__________________| [ENTER]

    (When [ENTER] is pressed, separate fields in separate forms all populate the same search term.)


    For example:

    SEARCH: |The Beatles | [ENTER]


    (The following, separate forms show up like this:

    SEARCH 2: |The Beatles | [ENTER]
    SEARCH 3: |The Beatles | [ENTER]
    SEARCH 4: |The Beatles | [ENTER]


    Any ideas? Is this possible? Can two forms act together on one page?



    Thanks,
    Dan

  • #4
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    There are many ways to do this.
    Here is an example of one way:
    Code:
    <script type="text/javascript">
    function popSearch() {
    d = document;
    var search = d.forms[0].S1.value;
    d.forms[1].S2.value = search;
    d.forms[2].S3.value = search;
    }
    </script>
    </HEAD>
    
    <BODY>
    <form>
    Search 1<input type="text" name="S1">
    <input type="button" value="Enter" onclick="popSearch()">
    </form>
    <form>
    Search 2<input type="text" name="S2">
    </form>
    <form>
    Search 3<input type="text" name="S3">
    </form>
    .....Willy

  • #5
    Regular Coder
    Join Date
    Dec 2003
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    NICE!!!

    Willy! You freaking genius! ;-)


    Can you please help me to get it to work on this site, please...?


    Click Here!


    Also, how can I get the "Go" to open in a new page?


    Thanks!
    Dan
    Last edited by Dan6971; 01-11-2004 at 05:52 AM.

  • #6
    Regular Coder
    Join Date
    Dec 2003
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Willy (or anyone else)? Are you still here? Please help me with my dilemma - you seem to know a lot about what you speak...

    I would love to be able to take the 2nd and 3rd search boxes and add them to 2 other searches, which can each, independently, search and go to another site.


    Click Here To Better Understand...


    Thanks,
    Dan
    Last edited by Dan6971; 01-11-2004 at 05:16 PM.

  • #7
    Regular Coder
    Join Date
    Dec 2003
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Help...

    Willy (or anyone)...

    Check Out This Awesome Coding!

    I got it to work, the way that I want, however, my first search uses an "Input Name" - "SEARCH" - but what do I do if my second search uses some other term?

    How can I get it to be dynamic?


    THANKS,
    Dan

  • #8
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    You have to specify each name in an array.
    Code:
    function UpdateFormSearchFields(frm,val){
      var fields = new Array("search","query","key","q"); //search field names
      var len = fields.length;
      for(var n=0;n<len;n++){
        if (frm.elements[fields[n]]) frm.elements[fields[n]].value = val;
        }
      }
    }
    Last edited by glenngv; 01-12-2004 at 07:47 AM.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #9
    Regular Coder
    Join Date
    Dec 2003
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks, Glenn...

    Now, I can get the searches to search properly, however, my third search will not populate with the search term added to the search at the top of the page, as the other searches do - please help...

    CLICK HERE


    Thanks,
    Dan

  • #10
    Regular Coder
    Join Date
    Dec 2003
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Does anyone know? Can anyone help me???


    Thanks,
    Dan

  • #11
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    You didn't use the solution I posted
    Code:
    function UpdateFormSearchFields(frm,val){
      var fields = new Array("search","more"); //search field names
      var len = fields.length;
      for(var n=0;n<len;n++){
        if (frm.elements[fields[n]]) frm.elements[fields[n]].value = val;
        }
      }
    }
    As you add more search fields with different names, you just add them in the array and that's it! The code will still work.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #12
    Regular Coder
    Join Date
    Dec 2003
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Glenn...

    Thank you for replying.

    I did add the code to this page but it does not populate my searches...

    I am not really good at this - so I may not have done it the same way. Can you just take the code from my page and please post it all here or post it on one of your webpages for me to get it from?


    Thank you so much, Glenn...



    Dan

  • #13
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts

    You still didn't use the solution I posted!

    If you just bothered to use the function I posted as is and replacing yours, then it would work.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #14
    Regular Coder
    Join Date
    Dec 2003
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Glenn...

    Let me say that you are really great at this stuff!


    OK, so I use your code:

    function UpdateFormSearchFields(frm,val){
    var fields = new Array("search","more"); //search field names
    var len = fields.length;
    for(var n=0;n<len;n++){
    if (frm.elements[fields[n]]) frm.elements[fields[n]].value = val;
    }
    }
    }


    And I replace this part of my code:

    function UpdateFormSearchFields(frm,val){
    var fields = frm.getElementsByTagName("input");
    var len = fields.length;
    for(var n=0;n<len;n++){
    var field = fields[n];
    if(field.type=="text" && field.name.indexOf("search")>-1){
    field.value = val;
    }
    }
    }


    I'm sorry if I don't understand. Do I need to replace more of my code or just the second part of that function? I am confused.


    Thanks 1000000000000000%,
    Dan

  • #15
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Glad I could be of help to you.
    No need to replace other codes.
    If in the future you add more search fields with names other than those in the array, then you need to add them.
    If you also use that function in other pages with different search field names, then you need to modify the array accordingly.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________


  •  
    Page 1 of 4 123 ... LastLast

    Posting Permissions

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