Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
Python, Lua and Tcl - public course schedule [here]
Private courses on your site - see [here]
Please ask about maintenance training for Perl, PHP, Java, C, C++, Ruby, MySQL and Linux / Tomcat systems
get input onchange into link

Posted by cyrene (cyrene), 14 December 2004
I have some links such as web,images and Sound file and an input text with default value(query). When no changes in input text and user click on any link,it will go to search the qurey according to the link.

But the problem is when there is changes in input text and user click on the link.It keep to search the old query according to link.

I wish it able to detect and search new query.

Here my code:

<script LANGUAGE="JavaScript">
function setquery(newquery) {
   var query = newquery;

print qq(<a href="/cgi-bin/result.cgi?cat=1&query=$query">WEB</a>  
                 <a href="/cgi-bin/result.cgi?cat=2&query=$query">IMAGES</a>  
                 <a href="/cgi-bin/result.cgi?cat=3&query=$query">SOUND FILE</a>              
                 <form name="form_search" method="post" action="/cgi-bin/result.cgi">
                     <div align="center">
                                     <input type="text" name="query" value="$query" size="30" onchange="setquery(this.value)">
                     <input type="submit" name="submit" value="Web Search" style="background-color:  #FFFAFA;">
                       <a href="/adsearch.html" class="one"><font size="-1">advanced web
                     <input type="hidden" name="cat " value=1>
                     </form>);                                                }

How Perl can get the changes in input text and  assign it into link when user click on it?

Posted by Custard (Custard), 14 December 2004

Not entirely sure I understand what you mean,


wouldn't this...

      <input type="hidden" name="cat " value=1>

point all queries to the same 'cat' ?
(and theres some spaces in there that may be a bad thing)

And, do you need setquery() at all?

I am confused, could you describe your problem some more.



Posted by cyrene (cyrene), 16 December 2004
i solve this problem by having some new link for old query and input text only for new query.

This page is a thread posted to the opentalk forum at and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2018: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01225 708225 • FAX: 01225 793803 • EMAIL: • WEB: • SKYPE: wellho