Help with html. Putting two inputs fields togehter

Hi guys,
I was developing a site search for someone and I got it fully functioning-- the php calls on the input field with #searchField.
All the user has to do is begin typing and the results appear underneath without ever having to click submit or enter/return.
However, the customer was wondering if I could integrate the Wolfram Alpha Computational Search as well.

So that a page visitor or user would type in the search field the results searching his site would appear below, as mentioned above; but, if one typed a query and hit enter then it would search WolframAlpha.

I first made a page, here, that uses the code Wolfram Alpha’s developer community was giving to developers that creates an input field and searches wolfram Alpha one hits enter. (It writes the necessary html in a messy way :frowning: :nono: and includes this [URL=“http://dl.dropbox.com/u/270523/help/base.css”]base.css file)
Here is a screenshot of the html code that the wolframAlpha.js file writes from chrome dev tools.

After doing so, I put the code of the page I developed for my client and the above page together and what I got was two separate input fields, one that searches the site (top, but it doesn’t work due because I did not attach that file as where this is located can’t parse PHP) and one that searches wolfram alpha (bottom – does work).
You can see the result of the combined code here.

I was wondering and hoping if you could help me or have any suggestions on how to combine these two input fields (and edit the wolframalpha javascript so that it does not write its own input, but uses the site search (top) one if and only if enter/return is pressed)

Thank you again & Kind Regards,
Team 1504.

It’s not appropriate to fiddle around with the code from wolfram alpha.
I will not help with that as it’s disrespectful, not to mention that it’s likely to get the “terms of use” lawyers upset.

What I can help with is to attach attach an onkeypress event to the wolfram alpha form field after the page has loaded, so that you can then take things over.

Here is the HTML with the extra input field removed, and the place to load the script.


<div id="smartSearch"> 
    <script type="text/javascript" id="WolframAlphaScript618b8f8031405754a8c4219c1b8c905e" src="wolframAlpha.js"></script> 
</div> 
<script src="script.js"></script>

Here is the script that attaches an onkeyup event to the wolfram input field.

script.js


function onkeyupHandler(evt) {
    var enterKey = 13;
    if (evt.keyCode !== enterKey) {
        // do your stuff here
    }
}

I know it is unethical.

and I tried to tell the client so. However, he/she justified by saying that they would have powered by WolframAlpha and a link to the site as the widgets that they allow do.

I was actually kind of hoping that it would be impossible or extremely hard to combine the input fields so that I could tell said the client that it could not be done :smiley:

Thank you for the help though.

I am going to try and convince them some more against it however.

Again, I apologise if you took this as an insult.