Solved

enable google get form within post action

Posted on 2003-10-24
74
354 Views
Last Modified: 2010-04-09
Hi

Can this google search be enabled within a post action.

The key is to retain one input box.

<FORM method=post action=" http://store.apple.com/1-800-MY-APPLE/WebObjects/AppleStore.woa/70906/wo/AO49YhxmiP193DkmmSA2MqIKqmc/0.0.7.1.0.5.11.1.0.1 ">

<input type="text" name="0.7.1.0.5.11.1.0.1.4" size="24" maxlength="255"><br />
         
<SELECT name="0.7.1.0.5.11.1.0.1.12">

<OPTION value="0">All </OPTION>
<OPTION value="1">Hardware</OPTION>
<OPTION value="2">Accessory</OPTION>
<OPTION value="3">Software</OPTION>
</SELECT>

<input type="submit"style= "width:77;text-align:center" value="Apple Store" > <br/>


<input type="hidden" name="q">

<input type="submit"style= "width:150;text-align:center" value="Google Search" onclick="this.form.q.value = this.form.search.value;
this.form.query.value = '';this.form.action = ' http://www.google.com/search ';this.form.method ='get'; "> <br />


</form>
0
Comment
Question by:macuser777
  • 34
  • 25
  • 9
  • +2
74 Comments
 
LVL 19

Expert Comment

by:Dexstar
Comment Utility
macuser777:

> Can this google search be enabled within a post action.

Google doesn't support post actions.  It won't work.

If you really want to do that, then you could do it server-side.  Have a page that accepts a POST form, and then redirects to the Google URL formed by the form fields.

Hope that helps,
Dex*
0
 
LVL 4

Author Comment

by:macuser777
Comment Utility
>Dex

is that the ONLY way i'm gonna be able to use one input box? Server-side is quite a bit beyond me at the moment.

Could i separate the 2 searches, put google in it's normal get form, and superimpose one text box ontop of the other with position code?

0
 
LVL 4

Author Comment

by:macuser777
Comment Utility
OR

can i do something like this

>>>Hey,
Let's suppose that Google did support POST, and you want to POST to google and GET to Lycos.
Your form would look like this: (notice the Google button action)

<form method="get">

<input type="hidden" name="q">
<input type="hidden" name="query">

<input type="text" name="search" size="20" maxlength="255" ><br />

<input type="submit"style= "width:150;text-align:center" value="Google Search" onclick="this.form.q.value = this.form.search.value; this.form.query.value = '';this.form.action = ' http://www.google.com/search '; this.form.method= 'POST';"> <br />


<input type="submit"style="width:150;text-align:center" value="Lycos" onclick="this.form.query.value = this.form.search.value; this.form.q.value = '';this.form.action = ' http://search.lycos.com/default.asp?lpv=1&loc=searchhp&query ';"> <br />

</form>
           

and put the apple search within the get form???
0
 
LVL 19

Expert Comment

by:Dexstar
Comment Utility
macuser777:

> is that the ONLY way i'm gonna be able to use one input box? Server-side is
> quite a bit beyond me at the moment.

Why don't you back up for a second, and explain what you're trying to do.  Maybe I can suggest something a way to do it.  You want a search page with a button to submit to Google and then another button to submit to Lycos?

Maybe we can do that.  But if you want 1 button that submits to BOTH at the same time, then I think you're out of luck.

Dex*
0
 
LVL 4

Author Comment

by:macuser777
Comment Utility
Hey Dex,

i DON"T want to submit to 2 engines at the same time.

What i want is to retain the look and feel of the code below and add the search for apple store, which unfortunately is a post action.

I want to find a way of keeping just one input box for both get form AND post action searches.

let me know if i'm still not making myself clear.

Thanks






<form method="get">

<input type="hidden" name="q">
<input type="hidden" name="query">

<input type="text" name="search" size="20" maxlength="255"><br />

<input type="submit"style= "width:150;text-align:center" value="Google Search" onclick="this.form.q.value = this.form.search.value; this.form.query.value = '';this.form.action = ' http://www.google.com/search ';"> <br />

<input type="submit" style="width:150;text-align:center" value="Teoma Search" onclick="this.form.q.value = this.form.search.value;this.form.query.value = '';this.form.action = ' http://www.teoma.com/search.asp ';"> <br />

<input type="submit"style="width:150;text-align:center" value="Lycos" onclick="this.form.query.value = this.form.search.value; this.form.q.value = '';this.form.action = ' http://search.lycos.com/default.asp?lpv=1&loc=searchhp&query ';"> <br />

</form>            
0
 
LVL 4

Author Comment

by:macuser777
Comment Utility
Here's the apple serach on its own

<FORM method=post action="http://store.apple.com/1-800-MY-APPLE/WebObjects/AppleStore.woa/70906/wo/AO49YhxmiP193DkmmSA2MqIKqmc/0.0.7.1.0.5.11.1.0.1">

<input type="text" name="0.7.1.0.5.11.1.0.1.4" size="24" maxlength="255"><br />
         
<SELECT name="0.7.1.0.5.11.1.0.1.12">

<OPTION value="0">All </OPTION>
<OPTION value="1">Hardware</OPTION>
<OPTION value="2">Accessory</OPTION>
<OPTION value="3">Software</OPTION>
</SELECT>

<input type="submit"style= "width:77;text-align:center" value="Apple Store" >

<FORM/>
0
 
LVL 19

Accepted Solution

by:
Dexstar earned 250 total points
Comment Utility
macuser777:

> I want to find a way of keeping just one input box for both get form AND post action searches.
>
> let me know if i'm still not making myself clear.

No, I think I understand.  Your general approach is good, but I would just make one small change that I think will help you out a lot.
Your problem is that each of those sites wants different parameters with different names, and they want different actions (some want POST, some want GET), right?

I would solve that problem by using different forms.  One form contains the field with the user input, but no submit button.  Then, you have one form for each of the search engines you want to submit to.  When the user clicks on the submit button for one of those forms, it will copy the value from the "dummy" form into the hidden property of the submit form, and then submit it.

That way, you can taylor each form for the specific web site setting the appropriate addresses and actions.

The user doesn't have to know that there are multiple forms.  All they will see is the input box and the list of buttons.

It's late in the day, and I'm not sure if I'm making sense or not...  Let me know if that needs more clarification.

Dex*
0
 
LVL 4

Author Comment

by:macuser777
Comment Utility
Dex,

that looks like an elegant solution if i've understood correctly.

One input box whose value is stored and copied to whichever submit button is pressed.

I like it.


Its 1 am where i am and i'm not going to be able to put it together tonite.

In fact it's pretty unlikely i'll be able to put it together at all without some coding help.

When you get some time i'd really appreciate it if you could post some example code that would combine the google and apple searches.

Thanks a lot - i couldn't believe there wasn't some way of doing it - i guess i just wasn't putting the question clearly.

I'll check in am tomorrow.

macuser



0
 
LVL 19

Expert Comment

by:Dexstar
Comment Utility
macuser777:

> When you get some time i'd really appreciate it if you could post some example
> code that would combine the google and apple searches.

You want me to do it for you on a 100 point question!?  :P
Seeing as I'm about done for the day myself, and I won't have much time this weekend, howabout you post your best attempt, and then we'll go from there?  :)

Your level of proficiency seems to be well above what would be required to pull it off...  

Dex*
0
 
LVL 4

Author Comment

by:macuser777
Comment Utility
:) !!!
hey - i'm happy to try - and i'll happily hand over all my remaining points for your help - i've got 400 left.

I wasn't trying to be funny getting a solution on the cheap - honest - if you look at my question history you'll see i'm no skinflint!!!

As to my  level of proficiency - well - this site has a lot to do with that - the limits of my skill are on display.

I underatand the logic of your solution but haven't much of a clue as to how to execute it. Still - that's how we learn i guess.

STILL, I WILL HAVE A GO!

Have a real good weekend

macuser
0
 
LVL 16

Expert Comment

by:jaysolomon
Comment Utility
this.form.action = ' http://www.google.com/search?q='+ this.form.search.value;


This will open google up and search for the value of the search field.
0
 
LVL 31

Assisted Solution

by:seanpowell
seanpowell earned 250 total points
Comment Utility
I finally understand what you're trying to do .... and agree with Dex's suggestion.

This is what I would do:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Search</title>
<style type="text/css">
<!--
input.text { width:150; text-align:left; }
input { width:150; text-align:center; }
//-->
</style>
</head>
<body>
<SCRIPT LANGUAGE="JavaScript">
<!--
function copydata() {

    myapple = "0.7.1.0.5.11.1.0.1.4"
    document.google.q.value      = document.myinput.search.value;
    document.teoma.q.value       = document.myinput.search.value;
    document.lycos.query.value   = document.myinput.search.value;
    document.apple.myapple.value = document.myinput.search.value;
   
    }
//-->
</SCRIPT>
<form name="myinput">
<input class="text" type="text" name="search" size="20" maxlength="255" value="imac">
</form>
<form method="get" name="google" onSubmit="return copydata()">
<input type="submit" value="Google Search" onclick="this.form.action='http://www.google.com/search'">
<input type="hidden" name="q">
</form>
<form method="get" name="teoma" onSubmit="return copydata()">
<input type="submit" value="Teoma Search" onclick="this.form.action='http://www.teoma.com/search.asp';">
<input type="hidden" name="q">
</form>
<form method="get" name="lycos" onSubmit="return copydata()">
<input type="submit" value="Lycos" onclick="this.form.action='http://search.lycos.com/default.asp';">
<input type="hidden" name="query">
</form>
<form method="post" name="apple" onSubmit="return copydata()">
<input type="submit" value="Apple Store" onclick="this.form.action='http://store.apple.com/1-800-MY-APPLE/WebObjects/AppleStore.woa/71106/wo/tx4tB2eQANCD3J5wviQKzOyvFds/2.0.7.1.0.5.11.1.0.1';"><br />
<select name="0.7.1.0.5.11.1.0.1.12">
<option value="0">All </option>
<option value="1">Hardware</option>
<option value="2">Accessory</option>
<option value="3">Software</option>
</select>
<input type="hidden" name="myapple">
</form>
</body>
</html>

Although for the life of me I can't seem to pass the apple text value - it may have something to do with a Saturday Morning Single Malt hangover.

Over to you Jay for finalising...
0
 
LVL 4

Author Comment

by:macuser777
Comment Utility
> Hey georgemarian,

I've just got back after weekend duties.

Thanks for that code i'm going to try it now.
I just wanted to post to you about that apple search in case you're trying to get it to work - you can't in its present form-

- it was going to be my next question -

- the apple search requires the user to log into the apple store first otherwise they are considered to have timed out -

- they have to pass through this address past.

http://store.apple.com/1-800-MY-APPLE/WebObjects/AppleStore/


SO - the qusetion is - can you post action to the second of 2 pages called up in sequence.

And all my points.... :)

{right - now to try your solution on my mac - pleeeeease no compatability issues!}


macuser
0
 
LVL 4

Author Comment

by:macuser777
Comment Utility
It sits well and properly on the page {ie one input box}, and accepts the post and get actions,
but it doesn't pass any value to google,teoma, lycos (apple we can't say) -
though it definitely goes to their search page

seems to me there might be something in this line

<input class="text" type="text" name="search" size="20" maxlength="255" value="imac">

I tried it without value="imac" but it does the same

either way it brings up this page with google

http://www.google.com/search?q=

and the equivalent with the other searches


 aren't we trying to give the input value a fixed name and then put it into the search something like this

this.form.action = ' http://www.google.com/search?q='+ this.form.search.value; (jaysoloman)
 
0
 
LVL 4

Author Comment

by:macuser777
Comment Utility
>georgemarian

your code brings up

imac

already in the input box - that's why i thought there might be something in that line
0
 
LVL 31

Expert Comment

by:seanpowell
Comment Utility
Sorry - that was just for test purposes, forgot to remove it:

<input class="text" type="text" name="search" size="20" maxlength="255">
0
 
LVL 31

Expert Comment

by:seanpowell
Comment Utility
>>SO - the qusetion is - can you post action to the second of 2 pages called up in sequence.

I have no idea - but if apple requires the login first, it's best not to bypass it.
0
 
LVL 4

Author Comment

by:macuser777
Comment Utility
>georgemarian
><input class="text" type="text" name="search" size="20" maxlength="255">      

     
i already tried that but it still wouldn't send any request.

brings up this for google

http://www.google.com/search?q=

and similarly with teoma and lycos, regardless of whether you input something or not.

Does it work for you?


>       >>SO - the qusetion is - can you post action to the second of 2 pages called up in sequence.

I have no idea - but if apple requires the login first, it's best not to bypass it.      

     - it's not a typed login just have to visit page - but we can leave that for now. Still would like to get the code working.
0
 
LVL 31

Expert Comment

by:seanpowell
Comment Utility
Does it work for you?

I wouldn't have posted if it didn't... It works on all bowsers that I have access to. So we're back to square one with Macs...
0
 
LVL 4

Author Comment

by:macuser777
Comment Utility
>brings up this for google

http://www.google.com/search?q=

- i mean in the address bar
0
 
LVL 4

Author Comment

by:macuser777
Comment Utility
>I wouldn't have posted if it didn't... It works on all bowsers that I have access to. So we're back to square one with Macs...      

     Sorry georgemarian - i should have checked first in other browsers after the problems we had the other day
- it works fine in Mozilla here

- i love my mac...but this is getting a bit painful all the time....OK - >browser issues

Thanks - we're getting there :)
0
 
LVL 31

Expert Comment

by:seanpowell
Comment Utility
Yes, but slowly - you patience is certainly a virtue.
0
 
LVL 4

Author Comment

by:macuser777
Comment Utility
I think it's easily matched by yours!

hey - it's better than just giving up - yesterday 2 experts (no-one on this q.) told me to just forget about it as the post and action wouldn't work on the same input box.

0
 
LVL 31

Expert Comment

by:seanpowell
Comment Utility
I don't see anything in apple's form that should preclude just passing the variables to the store directly - I think there may just be an error in the code I supplied.

I'll leave it up to those who know more about javascript than I do - which is just about everyone, to figure it out.
0
 
LVL 19

Expert Comment

by:Dexstar
Comment Utility
georgemarian:

> I finally understand what you're trying to do .... and agree with Dex's suggestion.
>
> This is what I would do:

Yeah, that is exactly what I had in mind.  :)  EE is good like that.  I think of something and just throw it out there, and then someone else brings it to life.  Makes me so happy!  :P

Dex*
0
 
LVL 31

Expert Comment

by:seanpowell
Comment Utility
I agree - I'd been following along the various threads and was confused about the intent until Macuser's explanation above. Most of the final js stuff is beyond me - so you're correct, the collaboration is what really makes the site work.
0
 
LVL 4

Author Comment

by:macuser777
Comment Utility
Thought i'd try and circumvent the javascript. No go but you might like to follow

http://www.experts-exchange.com/Web/Web_Languages/JavaScript/Q_20778115.html

there's a q. in browser issues but no feedback yet - i'll post it if it starts to turn anything up
0
 
LVL 15

Expert Comment

by:VincentPuglia
Comment Utility
Hi,


<html><head>
<SCRIPT>
<!--
function copydata(formObj, eformObj)
{
  myapple = "0.7.1.0.5.11.1.0.1.4"
  if (eformObj.engine[0].checked)
  {
    document.getElementById('hid').innerHTML = '<input type="hidden" name="q" value="' + eformObj.criteria.value + '" />'
    formObj.method = 'get';
    formObj.action = 'http://www.google.com/search?q=' +eformObj.criteria.value;
  }
  else
  {
    document.getElementById('hid').innerHTML = '<input type="hidden" name="myapple" value="' + eformObj.criteria.value + '" />'
    formObj.method = 'post';
    formObj.action=" http://store.apple.com/1-800-MY-APPLE/WebObjects/AppleStore.woa/71106/wo/tx4tB2eQANCD3J5wviQKzOyvFds/2.0.7.1.0.5.11.1.0.1";
  }

  return true;
}
//-->
</SCRIPT>
<body>
<form name='eform'>
<input type="text" name="criteria" size="20" maxlength="255">
Search Google: <input type="radio" name="engine" value="0">
Search Apple: <input type="radio" name="engine" value="1">
<br />
<select name="0.7.1.0.5.11.1.0.1.12">
<option value="0">All </option>
<option value="1">Hardware</option>
<option value="2">Accessory</option>
<option value="3">Software</option>
</select>
</form>
<form name="theForm" onSubmit="return copydata(this, document.eform)">
<span id="hid">
</span>
<input type="submit" value="Submit">

</form>
</body>
</html>

Vinny
0
 
LVL 15

Expert Comment

by:VincentPuglia
Comment Utility
tested in IE6.0, NN6.1, Firebird, Aol 8+

If Safari & the Mac don't do it, tough :)  I know the Mac's IE is tempermental and Safari doesn't support everything

Vinny
0
 
LVL 15

Expert Comment

by:VincentPuglia
Comment Utility
Hi mac,

as per your request:

http://members.aol.com/grassblad/getNpost.html

Vinny
0
 
LVL 4

Author Comment

by:macuser777
Comment Utility
      Well - change my name to macnuisance!!!

It works on your link!

presumably then so would the other solutions if i called them up from a www link

Nightmare Weaver more like - not to mention sleep depriver!

well - at least we have a solve - a range of solves in fact!

Apologies all round.

I'll try and see what my DW's upto tomorrow now.

Thanks all - (where's the keystrokes for embarressed face?)      

     
0
 
LVL 15

Expert Comment

by:VincentPuglia
Comment Utility
I knew I never liked the M(ickey)M(ouse) editor for a reason :)

Vinny
0
 
LVL 31

Expert Comment

by:seanpowell
Comment Utility
You're calling these scripts from Dreamweaver again! I thought we went over that already! Just save the pages and open them from IE - the same way a visitor to your site would...
0
 
LVL 4

Author Comment

by:macuser777
Comment Utility
>       You're calling these scripts from Dreamweaver again!

Morning georgemarian,

Actually in my in semi-conscious state last night i think i got lost in the mass of open files and browsers on my desktop and jumped the gun.

Vinny's last solution works fine launced from my dreamweaver but your earlier one won't - launched from d/weaver or opened from safari/IE
- so there's something about using the

return true

code that makes it work on safari/IE for mac

I was just fiddling with the code to try and add another get form search like
<form method="get" name="lycos" onSubmit="return copydata()">
<input type="submit" value="Lycos" onclick="this.form.action='http://search.lycos.com/default.asp';">
<input type="hidden" name="query">

AND change the format to named submit buttons rather than radio buttons to match the earlier look.

I was hoping to code it and then tidy up all the threads but i can't get it to work.




0
 
LVL 4

Author Comment

by:macuser777
Comment Utility
Also i double checked by asking a friend to run the code through their mac and d/weaver.
0
 
LVL 4

Author Comment

by:macuser777
Comment Utility
> seanpowell

I think this question has gone a bit off the tracks - due to me - so unless you, or anyone else, don't think it's a good idea, i'm going to close up all the threads and post a
new q. in Javascript with Vinny's solution and see if i can get it tailored to my needs.

When i say close i of course mean accept answers and award points.

macuser
0
 
LVL 4

Author Comment

by:macuser777
Comment Utility
>seanpowell

sorry if i'm being a pain, but if you get a chance could you post your original solution (minus the value'"imac") somewhere for me to check.

It's odd that that's how i got vinny's solution working and that's how i got your solution working the other day.

Just to put my mind at rest.

Thanks.

0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 31

Expert Comment

by:seanpowell
Comment Utility
Ultimately, the end result here is that you have a workable solution. It is the most important part of this whole process.
It would probably be beneficial for you to only have a single thread open to expedite getting this whole thing to work, before you go bananas. (Or maybe I should say apples)

Please - no points for me on this one. Perhaps post a link to the new JS thread so I can follow along and see how you make out!

Thanks,
seanpowell
0
 
LVL 31

Expert Comment

by:seanpowell
Comment Utility
Sure - from up above...

But remember - this isn't correctly getting the apple variable - it needs js to be completed.

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Search</title>
<style type="text/css">
<!--
input.text { width:150; text-align:left; }
input { width:150; text-align:center; }
//-->
</style>
</head>
<body>
<SCRIPT LANGUAGE="JavaScript">
<!--
function copydata() {

    myapple = "0.7.1.0.5.11.1.0.1.4"
    document.google.q.value      = document.myinput.search.value;
    document.teoma.q.value       = document.myinput.search.value;
    document.lycos.query.value   = document.myinput.search.value;
    document.apple.myapple.value = document.myinput.search.value;
   
    }
//-->
</SCRIPT>
<form name="myinput">
<input class="text" type="text" name="search" size="20" maxlength="255">
</form>
<form method="get" name="google" onSubmit="return copydata()">
<input type="submit" value="Google Search" onclick="this.form.action='http://www.google.com/search'">
<input type="hidden" name="q">
</form>
<form method="get" name="teoma" onSubmit="return copydata()">
<input type="submit" value="Teoma Search" onclick="this.form.action='http://www.teoma.com/search.asp';">
<input type="hidden" name="q">
</form>
<form method="get" name="lycos" onSubmit="return copydata()">
<input type="submit" value="Lycos" onclick="this.form.action='http://search.lycos.com/default.asp';">
<input type="hidden" name="query">
</form>
<form method="post" name="apple" onSubmit="return copydata()">
<input type="submit" value="Apple Store" onclick="this.form.action='http://store.apple.com/1-800-MY-APPLE/WebObjects/AppleStore.woa/71106/wo/tx4tB2eQANCD3J5wviQKzOyvFds/2.0.7.1.0.5.11.1.0.1';"><br />
<select name="0.7.1.0.5.11.1.0.1.12">
<option value="0">All </option>
<option value="1">Hardware</option>
<option value="2">Accessory</option>
<option value="3">Software</option>
</select>
<input type="hidden" name="myapple">
</form>
</body>
</html>
0
 
LVL 31

Expert Comment

by:seanpowell
Comment Utility
Sorry - you meant on the internet, didn't you :-(

http://www.pdgmedia.com/bananas.html
0
 
LVL 15

Expert Comment

by:VincentPuglia
Comment Utility
Morning gentlemen:

>> so there's something about using the return true code that makes it work on safari/IE for mac

>> onSubmit="return copydata()">

to paraphrase field of dreams: if you ask it, you must send it;


macuser:

is there any reason why you need to make them button? Here's lycos w/radio button

<html><head>
<SCRIPT>
<!--
function copydata(formObj, eformObj)
{
  var met = url = hidName ="";
  myapple = "0.7.1.0.5.11.1.0.1.4"
  for (i = 0; i < eformObj.length; i++)
  {
     el =eformObj.elements[i]
     if (el.name == 'engine' && el.checked)
     {
        switch (parseInt(el.value))
        {
          case 0:
            hidName =  'q';
            met = 'get';
            url =  'http://www.google.com/search';
            break;
          case 1:
            hidName =  'myapple';
            met = 'post';
            url =  "http://store.apple.com/1-800-MY-APPLE/WebObjects/AppleStore.woa/71106/wo/tx4tB2eQANCD3J5wviQKzOyvFds/2.0.7.1.0.5.11.1.0.1";
            break;
          case 2:
            hidName =  'query';
            met = 'get';
            url =  'http://search.lycos.com/default.asp'
            break;
           default:
               alert('bad ' + el.value)
          }
     }
   }
   document.getElementById('hid').innerHTML = '<input type="hidden" name="' + hidName + '" value="' + eformObj.criteria.value + '" />'
    formObj.method = met;
    formObj.action = url + '?' + hidName + '=' + eformObj.criteria.value;
  return true;

}


//-->
</SCRIPT>
<body>
<form name='eform'>
<input type="text" name="criteria" size="20" maxlength="255">
Search Google: <input type="radio" name="engine" value="0">
Search Apple: <input type="radio" name="engine" value="1">
Search Lycos: <input type="radio" name="engine" value="2">

<br />
<select name="0.7.1.0.5.11.1.0.1.12">
<option value="0">All </option>
<option value="1">Hardware</option>
<option value="2">Accessory</option>
<option value="3">Software</option>
</select>
</form>
<form name="theForm" onSubmit="return copydata(this, document.eform)">

<span id="hid">
</span>
<input type="submit" value="Submit">
</form>

</body>
</html>

Vinny
0
 
LVL 31

Expert Comment

by:seanpowell
Comment Utility
>>to paraphrase field of dreams: if you ask it, you must send it;

I'm not sure what you mean - a quick lesson for me if you could :-)
0
 
LVL 4

Author Comment

by:macuser777
Comment Utility
apples...bananas...pears...grapefruits....oh look .....there are some men in white coats....

There are insufficient keystrokes to produce the face i need to render.

>http://www.pdgmedia.com/bananas.html      

     IT WORKS!

??!??!??!!???etc

i'm going to lie down for a while then i'll come back and try it all again - i may be hallucinating due to sleep deprivation.

Oh and sean, you can't seriously not expect any points.

0
 
LVL 15

Expert Comment

by:VincentPuglia
Comment Utility
Hi Sean,

the onSubmit is asking for a return value -- therefore, it is expecting one before submitting.

Vinny
0
 
LVL 31

Expert Comment

by:seanpowell
Comment Utility
Then why is it functioning - or is that js being easy going?
0
 
LVL 15

Expert Comment

by:VincentPuglia
Comment Utility
>>Then why is it functioning - or is that js being easy going?  

???  which 'it'?  which 'js'?  & which browser?

offhand I would say IE doesn't care (since it tends to be least strict browser)

Vinny
0
 
LVL 31

Expert Comment

by:seanpowell
Comment Utility
I tried it on all 7 browsers that I have - and apart from not getting into the apple store - it appears to wok here.
0
 
LVL 4

Author Comment

by:macuser777
Comment Utility
>Vinny
>is there any reason why you need to make them button? Here's lycos w/radio button

Well - that's the design - you don't really want all my reasoning? - it just firs with waht i'm trying to do.

That aside

- i'm at a total loss.

If i cut and paste vinny's radio button solution with the lycos added and try and launch from d/w or open it as a file from my desktop with the browser already open it won't work. BUT i'm willing to bet that if i accessed the exaxt same code from a url link it would work - and then even wierder i could copy and paste it into d/w and it would work fine - that's what's happened twice on this q.
-once with georgemarian's code
-once with vinny's initila 2 radio button code.

???

>seanpowell

your url test link has a large space between the submit buttons - can this be reduced?
0
 
LVL 31

Expert Comment

by:seanpowell
Comment Utility
Yes:
http://www.pdgmedia.com/bananas.html

I would prefer to provide a visual clue that the select box only applies to the apple input button - it will depend on the layout of your page of course...
0
 
LVL 4

Author Comment

by:macuser777
Comment Utility
>>I would prefer to provide a visual clue that the select box only applies to the apple input button - it will depend on the layout of your page of course...      

I'm planning a layout like this. The buttons are too long i know - they take up too much room - but if i can (later) put an actual apple image where it says apple now i'll be able to bring the whole column into a more manageable size.
   
               

<input type="text" name="0.7.1.0.5.11.1.0.1.4" size="23" maxlength="255"><br />
         
<SELECT name="0.7.1.0.5.11.1.0.1.12">

<OPTION value="0">All </OPTION>
<OPTION value="1">Hardware</OPTION>
<OPTION value="2">Accessory</OPTION>
<OPTION value="3">Software</OPTION>

</SELECT>

<input type="submit"style= "width:77;text-align:center" value="Apple Store" > <br/>

<input type="submit"style= "width:170;text-align:center" value="Google Search" onclick="this.form.q.value = this.form.search.value; this.form.query.value = '';this.form.action = ' http://www.google.com/search ';"> <br />

<input type="submit" style="width:170;text-align:center" value="Teoma Search" onclick="this.form.q.value = this.form.search.value;this.form.query.value = '';this.form.action = ' http://www.teoma.com/search.asp ';"> <br />

<input type="submit"style="width:170;text-align:center" value="Lycos" onclick="this.form.query.value = this.form.search.value; this.form.q.value = '';this.form.action = ' http://search.lycos.com/default.asp?lpv=1&loc=searchhp&query ';"> <br />


 
0
 
LVL 31

Expert Comment

by:seanpowell
Comment Utility
0
 
LVL 4

Author Comment

by:macuser777
Comment Utility
Dude! :)))))))))) - now i'll look at the source!
0
 
LVL 4

Author Comment

by:macuser777
Comment Utility
ohhhhh... tantalising sean but not quite.

It worked like a charm at first. But see waht happens if you close your browser and the open it and try again. I get the same timed out error page.
0
 
LVL 4

Author Comment

by:macuser777
Comment Utility
hang on ... i've got my bananas and pears mixed up...i think you've got it after all...
0
 
LVL 31

Expert Comment

by:seanpowell
Comment Utility
A little smaller - better alignment.
http://www.pdgmedia.com/pears.html
0
 
LVL 4

Author Comment

by:macuser777
Comment Utility

Wow is all i can say.

As far as i can see the only change is this

/70307/wo/XD7aY1jio8mr2yiXMP32pcN7sWO

right???




Any chance of an allignment like this

<input type="text" name="0.7.1.0.5.11.1.0.1.4" size="23" maxlength="255"><br />
         
<SELECT name="0.7.1.0.5.11.1.0.1.12">

<OPTION value="0">All </OPTION>
<OPTION value="1">Hardware</OPTION>
<OPTION value="2">Accessory</OPTION>
<OPTION value="3">Software</OPTION>

</SELECT>

<input type="submit"style= "width:77;text-align:center" value="Apple Store" > <br/>

<input type="submit"style= "width:170;text-align:center" value="Google Search" onclick="this.form.q.value = this.form.search.value; this.form.query.value = '';this.form.action = ' http://www.google.com/search ';"> <br />

<input type="submit" style="width:170;text-align:center" value="Teoma Search" onclick="this.form.q.value = this.form.search.value;this.form.query.value = '';this.form.action = ' http://www.teoma.com/search.asp ';"> <br />

<input type="submit"style="width:170;text-align:center" value="Lycos" onclick="this.form.query.value = this.form.search.value; this.form.q.value = '';this.form.action = ' http://search.lycos.com/default.asp?lpv=1&loc=searchhp&query ';"> <br />
0
 
LVL 4

Author Comment

by:macuser777
Comment Utility
Ah! - the selct box should be justified left like the google search, bringing the whole thing into one column
0
 
LVL 31

Expert Comment

by:seanpowell
Comment Utility
0
 
LVL 31

Assisted Solution

by:seanpowell
seanpowell earned 250 total points
Comment Utility
>>As far as i can see the only change is this
/70307/wo/XD7aY1jio8mr2yiXMP32pcN7sWO

No, it's how the javascript is passing the input text name:
<input type="hidden" name="0.7.1.0.5.11.1.0.1.4">
0
 
LVL 4

Author Comment

by:macuser777
Comment Utility
No sorry - that code i sent you was a bit messed up.

What i meant was - the apple select box in line with the apple store submit button. The apple store submit button reduced in length.

(select box)( apple store)
(    google search          )
(    teoma search          )
(    lycos search            )

brackets represent submit buttons

-just got that js expalnation - will have a look now
0
 
LVL 15

Expert Comment

by:VincentPuglia
Comment Utility
Hi macuser,

>> try and launch from d/w or open it as a file from my desktop with the browser already open it won't work

To me, it sounds like poor garbage collection on dw's part.  I use cuteHTML (ver 1.2) and it also occasionally will not allow me to launch the alternate browser from within the program.

Not to take away from Sean Powell's code, but I still do not see the need for a form for each engine.  If you want to use buttons, you can still use my code (with some small modification), simply use an input type button rather than a submit, as in:

<html><head>
<SCRIPT>
<!--
function copydata(formObj, eformObj, val)
{
  var met = url = hidName ="";
  myapple = "0.7.1.0.5.11.1.0.1.4"

  switch (val)
  {
          case 0:
            hidName =  'q';
            met = 'get';
            url =  'http://www.google.com/search';
            break;
          case 1:
            hidName =  'myapple';
            met = 'post';
            url =  "http://store.apple.com/1-800-MY-APPLE/WebObjects/AppleStore.woa/71106/wo/tx4tB2eQANCD3J5wviQKzOyvFds/2.0.7.1.0.5.11.1.0.1";
            break;
          case 2:
            hidName =  'query';
            met = 'get';
            url =  'http://search.lycos.com/default.asp'
            break;
           default:
               alert('bad ' + el.value)
   }
   document.getElementById('hid').innerHTML = '<input type="hidden" name="' + hidName + '" value="' + eformObj.criteria.value + '" />'

    formObj.method = met;

    formObj.action = url + '?' + hidName + '=' + eformObj.criteria.value;

  formObj.submit();

  return true;

}
//-->
</SCRIPT>
<body>
<form name='eform'>
<input type="text" name="criteria" size="20" maxlength="255">
<input type="button" value="Google" onclick="return copydata(document.theForm, this.form,0)">
<input type="button" value="Apple" onclick="return copydata(document.theForm, this.form,1)">
<input type="button" value="Lycos" onclick="return copydata(document.theForm, this.form,2)">

<br />
<select name="0.7.1.0.5.11.1.0.1.12">
<option value="0">All </option>
<option value="1">Hardware</option>
<option value="2">Accessory</option>
<option value="3">Software</option>
</select>
</form>
<form name="theForm">

<span id="hid">
</span>
</form>


</body>
</html>

Then, you only have to fiddle with the alignment of one form, not five or twenty;
Vinny
0
 
LVL 31

Expert Comment

by:seanpowell
Comment Utility
0
 
LVL 31

Expert Comment

by:seanpowell
Comment Utility
Vinny - that code doesn't appear to work with the Apple store...

It's only 3 buttons - I'm just happy it works.
0
 
LVL 15

Expert Comment

by:VincentPuglia
Comment Utility
Hi Sean,

   I didn't test the apple store because i have no idea what the url should look like. But, offhand it probably doesn't work because I didn't add "?=" + eformObj.criteria.value

Vinny
0
 
LVL 4

Author Comment

by:macuser777
Comment Utility
My cup runneth over.

Sean, that's exactly the format i was looking for. Perfect. :))))))))))))))))))))))))))))))))

Vinny, you got me back on track by putting up a link to your code - :))))))))))))))))))))))))))))))))

Plus i've got alternatives to play with and learn from.

Phew. We got there - and just 2 days ago they said it couldn't be done!

points all round

Vinny, you've collected 400 on related q.s
Dex - 250
Sean - 250




0
 
LVL 31

Expert Comment

by:seanpowell
Comment Utility
That's very kind - and happy searching!

Thanks
seanpowell
0
 
LVL 4

Author Comment

by:macuser777
Comment Utility
yw

..and...

errr  hmmmm -

 part III of this paq builder will emerge in a few days :}

- it's a humdinger!

-

0
 
LVL 4

Author Comment

by:macuser777
Comment Utility
>seanpowell

Are you still there?

My /pears solution is now giving the timed out error page?

Is your's still working?
0
 
LVL 4

Author Comment

by:macuser777
Comment Utility
>seanpowell

Its that thing about changing this part of the address.

If you visit the apple store page, then perform a search, then lift the corresponding part of the address and put it in your code
the store search works again.

So we know the request is being processed correctly - its the the timeout that's causing the problem.

71207/wo/Dq5T2Nn89qYY2qLO0PT17SEjv83

Let me know if i'm not just talking to myself here!
0
 
LVL 31

Expert Comment

by:seanpowell
Comment Utility
It is now:
http://www.pdgmedia.com/pears.html

Just looked at the source from the apple store page - it's a new link :-(

They change the URL of the post action in the form dynamically - so I think we can pretty much say goodbye to searching the store outside of apple - inless you can ask them to send you the new URL every hour os so.
0
 
LVL 4

Author Comment

by:macuser777
Comment Utility
It seems to me that on top of the time out they issue a new url every time you close and reopen a browser.
If you open the same page in 2 different types of browser you should see 2 different urls.
Then, presumably the url you get is timed out on your own pc somehow.

hmmmm

There might still be a way but it's gonna be complicated.

I'm sure i've read somewhere that you can lift a url out of an address bar.
If you can you can you could then insert it dynamically on a refresh cycle.
Like i said - complicated.

AND/OR i could try opening up the store in an invisible frame and see if that in itself will allow a store search - would have to change the apple store search code somehow to accomodate this.

- tricky tricky tricky. Goes back to the original problem of opening 2 pages in sequence as well. To get the url you'd have to make a fresh visit to
to the store page and hit the search button.

And as you say, I could  ask to be sent a relevant url every so often as well.

There's bound to be a way.

i'll chew it over.







0
 
LVL 31

Expert Comment

by:seanpowell
Comment Utility
>>It seems to me that on top of the time out they issue a new url every time you close and reopen a browser.

I can open the page in a number of different browsers without any problems, but I believe the URL changes from time to time - or perhaps it's a caching issue. I don't know anything about how webobjects works...

However, I would send Apple an email asking them if it's possible for you to have a search form on your site for their store. If they say no - because of how the store works, then you'll save yourself a lot of time - and points - as opposed to guessing in the dark. Don't you think?
0
 
LVL 4

Author Comment

by:macuser777
Comment Utility
You're right for sure.

I just don't like letting go of the problem.

What i'll probably do is finish the site in dummy form and then email them.

(- also  - i can open up your pears page from various browsers and search no problem too.)

they have a special developer section email. I'll let you know.

By the way - this q. was unrelated to that other one about country select from apple store.
That's for another site so i'm not left twiddling my thumbs!

macuser
0
 
LVL 31

Expert Comment

by:seanpowell
Comment Utility
Do let me know - I'm curious to see how this plays out :-)

0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
In this tutorial viewers will learn how to define a gradient in CSS. Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Gradient. Define the background as "linear-gradient(to right, #ee3668, black)". Ensure you …
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now