PatPHP Posted October 1, 2009 Share Posted October 1, 2009 Hi Guys I'm not very experienced with Javascript. But I found a pretty cool AJAX Script which allows text auto completion like you have seen in fb or google search. It's called Proto!MultiSelect. Now this script works perfect but the example page also only displays the values in a message box. How can I send this information via Post to a php webpage instead? Here test webpage: http://www.interiders.com/2008/02/18/protomultiselect-02/ If I press the Get Values button I want to send this values to a php page instead of showing it in a message box. Here the code if it helps: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <title>Proto!MultiSelect Demo</title> <link rel="stylesheet" href="test.css" type="text/css" media="screen" title="Test Stylesheet" charset="utf-8" /> <script src="protoculous-effects-shrinkvars.js" type="text/javascript" charset="utf-8"></script> <script src="textboxlist.js" type="text/javascript" charset="utf-8"></script> <script src="test.js" type="text/javascript" charset="utf-8"></script> </head> <body id="test"> <h1>Proto!MultiSelect Demo</h1> <p><a href="http://www.interiders.com/2008/02/18/protomultiselect-02/">See article page</a>, <a href="http://www.interiders.com/wp-content/demos/ProtoMultiSelect/test.html">Go to Proto!MultiSelect demo</a></p> <div id="text"></div> <form action="test_submit" method="get" accept-charset="utf-8"> <ol> <li class="input-text"> <label>Simple input</label> <input type="text" name="testinput" value="" id="testinput" /> </li> <li id="facebook-list" class="input-text"> <label>FacebookList input</label> <input type="text" value="" id="facebook-demo" /> <div id="facebook-auto"> <div class="default">Type the name of an argentine writer you like</div> <ul class="feed"> <li value="1">Jorge Luis Borges</li> <li value="2">Julio Cortazar</li> </ul> </div> <!-- These two writers will be added when the control is loaded --> </li> </ol> </form> <div id="button_container"> <button onclick="tlist2.update(); alert($F('facebook-demo'));return false;">Get Values</button> </div> <script language="JavaScript"> document.observe('dom:loaded', function() { // init tlist2 = new FacebookList('facebook-demo', 'facebook-auto',{fetchFile:'fetched.php'}); // fetch and feed new Ajax.Request('json.php', { onSuccess: function(transport) { transport.responseText.evalJSON(true).each(function(t){tlist2.autoFeed(t)}); } }); }); </script> </body> </html> Quote Link to comment Share on other sites More sharing options...
PatPHP Posted October 1, 2009 Author Share Posted October 1, 2009 Cool;-) I found a solution;-) Just add a hidden field to the form and assign value to it before you send it;-) <form name="frm" method="post"> <input type='hidden' name='participations'/> </form> <button onclick="tlist2.update(); send();">Send</button> <script language="JavaScript"> function send() { window.document.frm.participations.value = $F('multiselectlist-demo'); window.document.frm.action = "get.php" window.document.frm.submit() } </script> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.