By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,462 Members | 1,057 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,462 IT Pros & Developers. It's quick & easy.

Help me to submit my form with javascript please

P: 3

I have a frames page that has a header, body and a footer. The header frame has an ajax autocomplete that returns a number and a string from a database.

Here is what happens. The user looks up a client in the autocomplete textbox. The ajax autocomplete give the user choices. the user selects the one he wants with either his mouse or the arrow keys and then presses ENT. THERE IS NO SUBMIT BUTTON.

The value that was returned by ajax needs to go to a php script where it will do a lookup by the customer number. The value returned by ajax is the customer's number.

This returned value is what I need help with. I need to get the returned ajax value into my query sting (GET) so I can populate the body frame with the correct info. I am having a really hard time with this and can't make any headway.

I know no javascript at all so please spell things out for me.

Here is the relavent code.

Expand|Select|Wrap|Line Numbers
  1. <form method="post" class="hdrForm" id="search" action="../../index.php?ds=2" target="_top">
  2. <input type="text" name="string" class="hdrInput" id="string" value=""><div id="acDiv"></div>
  3. </form>
Expand|Select|Wrap|Line Numbers
  1. var AC = new Suggest('string','acDiv');
  2. AC.ajaxTarget = '../../lib/inc/suggest.php';
  3. AC.chooseFunc = function(id,label)
  4. {
  6. }
Thanks for any help you can provide.
Apr 2 '09 #1
Share this Question
Share on Google+
2 Replies

P: 3
I have actually figured out most of this already but I am still having a problem.

Here are two functions. I need to use the "id" variable in the SubmitForm() function as well. Can someone please tell me how to do this? This is how new I am to js. :)

Thanks for the help.
Expand|Select|Wrap|Line Numbers
  1.   AC.chooseFunc = function(id,label)
  2.   {
  3.     document.qSearch.action = ".index.php?dc=2&id="+ id;
  4.     //document.qSearch.action = "index.php?dc=2";
  5.     document.qSearch.submit();
  6.   }
  8.   *** This one fails.
  9.   function SubmitForm(id)
  10.   {
  11.     document.qSearch.action = "index.php?dc=2&id="+ id;
  12.     document.qSearch.submit()
  13.   }
What I need is the "id" var appended to the query string in the SubmitForm Function. Can someone tell me how to do this please? Thanks for the help!
Apr 3 '09 #2

P: 3
Solved! Thanks for the help
Apr 3 '09 #3

Post your reply

Sign in to post your reply or Sign up for a free account.