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 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    New Coder
    Join Date
    Sep 2012
    Posts
    26
    Thanks
    17
    Thanked 0 Times in 0 Posts

    Question How to send input Data on one form to another?

    Hi,

    Is it possible to send input data from one form to another?

    Say, I have an Input form for text. I want to send the text as 'Input' to another form which is on a different page.

    Can I choose multiple methods to input the data on the first page , but however I choose to enter the form, can this input be transferred as input on the other form?

    Thanks!

  • #2
    Senior Coder jmrker's Avatar
    Join Date
    Aug 2006
    Location
    FL
    Posts
    3,026
    Thanks
    36
    Thanked 494 Times in 488 Posts
    How much data are we talking about?

  • Users who have thanked jmrker for this post:

    codernoob (09-23-2012)

  • #3
    New Coder
    Join Date
    Sep 2012
    Posts
    26
    Thanks
    17
    Thanked 0 Times in 0 Posts
    Idea is:

    Two options to enter data on the first form which is visible.
    Search field on Page 'A' (input option 1)
    Search field by Drop down keyword on page A (input option 2).

    User inputs 'Search keyword' or choose a 'Preselected Search Keyword' on Page A form.

    This keyword entered in the form is sent to page B. Page B is hidden. Page B has a Search input field. The input from A is entered directly to Page B 'Search' Field (form)

    Search is performed on Page B and Results is displayed on Page A.

    I am kinda lost in ensuring that the keyword entered in A (using the two options) is directly transferred to the form input field of B (displaying results is easier)
    does that help?

  • #4
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,772
    Thanks
    55
    Thanked 518 Times in 515 Posts
    if they're normal sized words the easiest way to do it would be with query strings

  • Users who have thanked xelawho for this post:

    codernoob (09-23-2012)

  • #5
    New Coder
    Join Date
    Sep 2012
    Posts
    26
    Thanks
    17
    Thanked 0 Times in 0 Posts
    This would be on a local system without internet/server - only a bunch of PC connected. If my understanding is rt, i would need ASP to get QueryStrings to work?

  • #6
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,772
    Thanks
    55
    Thanked 518 Times in 515 Posts
    that's not my understanding, but then I have never used a query string on intranet. But any page that you access via url can accept a query string, so I'm guessing that it shouldn't be a drama.

    Having just read your question again, though, it seems kind of weird to me... why does page B have to come into it, if the search term is entered on page A and results are displayed on page A?

  • Users who have thanked xelawho for this post:

    codernoob (09-23-2012)

  • #7
    New Coder
    Join Date
    Sep 2012
    Posts
    26
    Thanks
    17
    Thanked 0 Times in 0 Posts
    Thanks Xelawho,

    The reason am using two pages is related to the fact that I was unable find a code to separate the choice of search.

    Below is what am trying on a single page, but this doesnt work as it doesnt know which search input to pick.

    Search - by inputing keyword (lets say A-GO)

    Code:
    <form action="ss.html" target="LEFT">
    <b>Search this site</b><br>
    <input type="text" name="s">
    <input type="submit" value="Go">
    </form>
    AND

    Search - by predefined keywords from a drop down list (B-GO)
    Code:
    <select name="s" onClick="return NS()">
      <option value=""></option> 
      <option value="value2">Value 2</option>
      <option value="value3">Value 3</option>
    </select>
    I want the two options to be available in the div, and based on the user choosing either A-GO or B-GO, the results would be displayed using

    Code:
    function C(l){
     parent.RIGHT.location.href=l;
    }
    But this hasnt been possible and i tried quite a few tweaks. So I thought, why not hide the page (B) where actual search happens, and feed that page with inputs using different feeds (from Page A - and input when pressed go)

    err, kinda complex to explain...
    Last edited by codernoob; 09-23-2012 at 10:53 PM.

  • #8
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,772
    Thanks
    55
    Thanked 518 Times in 515 Posts
    I asked you a clarifying question on this point in this post and you never replied - if it's one button for the dropdown and one button for the text input that's easy to keep all on the one page - much easier than what you are proposing, anyway. So is that the deal?

  • #9
    New Coder
    Join Date
    Sep 2012
    Posts
    26
    Thanks
    17
    Thanked 0 Times in 0 Posts
    i was kinda confused and was trying to find a solution/frame an answer that would clear.

    As to what you have mentioned, that would be just fine as well..

    Just one button for both options.

    But something that worries me from that point is - what if someone has entered a search keyword (say by error) and then chooses an option from the drop down (as well) and then clicks go - which entry would be searched?

  • #10
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,020
    Thanks
    75
    Thanked 4,323 Times in 4,289 Posts
    I'm just curious how in the world he is going to do this:
    Code:
    <b>Search this site</b><br>
    with a <form> that posts to another HTML page
    Code:
    <form action="ss.html" target="LEFT">
    Normally, site searches have to be carried out with server-side code, which an HTML page clearly isn't.

    But I agree. He seems to want to make it 3 or 4 times harder than it needs to be, no matter how the search is done.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #11
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,020
    Thanks
    75
    Thanked 4,323 Times in 4,289 Posts
    Quote Originally Posted by codernoob View Post
    ]
    But something that worries me from that point is - what if someone has entered a search keyword (say by error) and then chooses an option from the drop down (as well) and then clicks go - which entry would be searched?
    Depends on how you write the code. You could give precedence to the <select> choice or you could give it to the <input> value. Utterly up to you.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • Users who have thanked Old Pedant for this post:

    codernoob (09-23-2012)

  • #12
    New Coder
    Join Date
    Sep 2012
    Posts
    26
    Thanks
    17
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Old Pedant View Post
    I'm just curious how in the world he is going to do this:
    Code:
    <b>Search this site</b><br>
    with a <form> that posts to another HTML page
    Code:
    <form action="ss.html" target="LEFT">
    Normally, site searches have to be carried out with server-side code, which an HTML page clearly isn't.

    But I agree. He seems to want to make it 3 or 4 times harder than it needs to be, no matter how the search is done.

    I found this brilliant piece of work online.. which i have tried with my minimal skills to add to my site.

    http://www.buildwebsite4u.com/tools/site-search.shtml
    but kinda looks like I have used up all the bits I know:

  • #13
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,772
    Thanks
    55
    Thanked 518 Times in 515 Posts
    as to the preference dilemma, you could make the last element that the user focussed on the one that the code uses for the search term. It's not perfect, but (thinking about it for two seconds) it seems the only problem would be if someone say, entered something in the text, then chose an option from the dropdown, then clicked on the box again for some reason, then clicked the search button.

    the bigger concern is making a confusing interface - short of having a little instruction paragraph (which 90% of users are guaranteed not to read), it seems to me that it would be better to have two clearly labelled buttons - "search from input" and "search from options" or some such...

  • Users who have thanked xelawho for this post:

    codernoob (09-24-2012)

  • #14
    New Coder
    Join Date
    Sep 2012
    Posts
    26
    Thanks
    17
    Thanked 0 Times in 0 Posts
    yes, I guess having two different buttons will do.. and its a small group who will use this (whom I see everyday)

    But from a coding perspective, how should i go about it? As old pendant mentioned, can the code have the possibility of precedence ?

    Thanks for your help!!

  • #15
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,772
    Thanks
    55
    Thanked 518 Times in 515 Posts
    if you have two buttons all you need to do is pass the name of the element that contains the search term to the function and let it sort it out.

    Looking at the code you posted in the other thread, I would say that:
    1. you name your select "p" and your input "q"

    2 you change the onclick for the two buttons to
    Code:
    onClick="return NS('p')"
    and
    Code:
    onClick="return NS('q')"
    respectively

    then you change your NS function to

    Code:
    function NS(el){
     if(document.getElementById) document.getElementById('txt').innerHTML=MT(el);
     else document.forms[0].submit();
     return false;
    }
    and the first couple of lines of your MT function to

    Code:
    function MT(el){
     var c,i,n,t="",ss="",s=document.forms[0][el].value.toLowerCase()+' ';
    at which point it seems you're good to go. I'm not sure, though - the code posted in the other thread was incomplete, so it's hard to test, but that seems to be it.

  • Users who have thanked xelawho for this post:

    codernoob (09-24-2012)


  •  
    Page 1 of 2 12 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
    •