• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

trying to submit form on another site from my JSP

 
Ranch Hand
Posts: 618
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay, hopefully I won't get in trouble for showing all this...below is the code for what I'm trying to do, and it's not submitting to the form mentioned (it just seems to do nothing). Maybe you can try to get it to work and let me know the workaround. Above what I'm pasting below is my Java code within JSP's <% %> tags. I'm using the IntelliJ Idea IDE and although I'm not compiling with it, it's not complaining about any imports needed or anything like that (it's good at doing that at editing time). If you try this yourself, don't worry about submitting the form at the site, b/c after that there's a confirmation page before you fully submit. Btw, I've tried it both with and without quote marks around the field name.
<html>
<body>
<form name="SAPF" method="POST" action="http://sbw.airborne.com/SchedulePickup/SchedulePickupInfo.asp">
<input type=hidden name=F10050 value="08222003">
<input type=hidden name=F10051 value="1200">
<input type=hidden name=F10052 value="1700">
<input type=hidden name=F10055 value="1">
<input type=hidden name=F10026 value="<%=oBill.getCompanyName()%>">
<input type=hidden name=F10027 value="<%=oBill.getAddress1()%>">
<input type=hidden name=F10028 value="<%=oBill.getAddress2()%>">
<input type=hidden name=F10029 value="<%=oBill.getCity()%>">
<input type=hidden name=F10030 value="<%=oBill.getState()%>">
<input type=hidden name=F10031 value="<%=oBill.getZip()%>">
<input type=hidden name=F10018 value="<%=oBill.getAttn()%>">
<input type=hidden name=F10025 value="<%=oBill.getShipperPhone()%>">
</form>
I learned to do this from here:
http://forum.java.sun.com/thread.jsp?forum=45&thread=436406&tstart=0&trange=15
[ August 21, 2003: Message edited by: Stephen Huey ]
 
Ranch Hand
Posts: 476
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


...below is the code for what I'm trying to do, and it's not submitting to the form mentioned (it just seems to do nothing).


When you say this, do you mean when you submit the form nothing happens meaning even in status bar there is no indicator of page being loaded, or do you mean that browser just sits there like nothing is going on?
Alex
[ August 21, 2003: Message edited by: Alex Kravets ]
 
Alex Kravets
Ranch Hand
Posts: 476
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also, I trust that in your actual form you have a submit button.
[ August 21, 2003: Message edited by: Alex Kravets ]
 
Stephen Huey
Ranch Hand
Posts: 618
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My actual form has no submit button, and it doesn't appear to need one, either. When my users click the link to my form page, the form on my page seems to auto-submit itself with that Javascript at the bottom. Then (after a split second), it takes me to the URL in question, but when it gets there, it looks just the way it does when you load that page normally. I would know if there were errors in submission or if incomplete information was being submitted, b/c their page (the Airborne one) comes back and tells you that you missed some info or whatever. So, what I'm wondering is if I have to do some more involved coding to POST some info to that form or what...also, am I specifying everything I need to? For example, when I give it that URL to submit to, do I need to somehow tell it WHICH form on that page to submit to, or does it do that automatically? I'm wondering how it would know if there were multiple forms on that page...
 
Alex Kravets
Ranch Hand
Posts: 476
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can you post javascript that submits the page?
 
Stephen Huey
Ranch Hand
Posts: 618
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Whoops, sorry about that--here's the complete code:
<html>
<body>
<form name="SAPF" method="POST" action="http://sbw.airborne.com/SchedulePickup/SchedulePickupInfo.asp">
<input type=hidden name="F10050" value="08222003">
<input type=hidden name="F10051" value="1200">
<input type=hidden name="F10052" value="1700">
<input type=hidden name="F10055" value="1">
<input type=hidden name="F10026" value="<%=oBill.getCompanyName()%>">
<input type=hidden name="F10027" value="<%=oBill.getAddress1()%>">
<input type=hidden name="F10028" value="<%=oBill.getAddress2()%>">
<input type=hidden name="F10029" value="<%=oBill.getCity()%>">
<input type=hidden name="F10030" value="<%=oBill.getState()%>">
<input type=hidden name="F10031" value="<%=oBill.getZip()%>">
<input type=hidden name="F10018" value="<%=oBill.getAttn()%>">
<input type=hidden name="F10025" value="<%=oBill.getShipperPhone()%>">
</form>

<script language="Javascript">
document.SAPF.submit();
</script>
</body>
</html
 
Alex Kravets
Ranch Hand
Posts: 476
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's kind of hard to follow when there is no complete code. But I guess the link that you mentioned where a user clicks must have some kind of javascript property that performs the actual submition.
Also on you action page (which seems to be ASP page) how do you receive your hidden parameters?
 
Stephen Huey
Ranch Hand
Posts: 618
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, the link my users follow to get to the above page is a simple hyperlink with a relative URL to the name of the page. Nothing fancy there. What happens is, when the page above gets loaded, that simple little Javascript statement (that I picked up from a guy in a Sun forum, as I mentioned at the top of this thread) at the bottom of my code auto-submits the form on the page as soon as the page is loaded (so that I see the page for only a split second before it loads the Airborne page in the browser). Because I then see the Airborne page in the browser, I feel I can safely assume that it submitted my form, b/c the form action attribute is the only place I tell it anything about that Airborne page.
Now, I don't have any control over Airborne's ASP page. I can't see any more of the ASP code than you can. Although I'd like to be able to automatically submit it from within my code, all I can do right now is go to it in a web browser, type some stuff in, and submit it to see either a confirmation page, or the same page telling me that I entered some errors. You can easily mimic what I'm trying to do by creating a simple HTML page with the following text:

In other words, the above should be complete code. Notice that I took out the fields whose values were coming from my Java/JSP code and just left the ones that were hardcoded text values. That part shouldn't matter here. If there were an error with that part, then I would've expected the page I'm submitting to to tell me that there were errors with the data I was entering. But I can't even get that page I'm submitting to to even submit! I'm trying to POST to it, and that doesn't seem to be working. Look at the source on that Airborne page and you can see the name of the form there--am I supposed to somehow tack that form name onto the URL above to specify WHICH form I'm posting to, or do I not need to do that?
Now, if you can get the above to actually submit, then I'd expect to see warnings in red text telling me that I didn't fill in all the fields. That would be heavenly to see. I just don't know why I'm not seeing that!
Thanks,
Stephen
 
Alex Kravets
Ranch Hand
Posts: 476
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yup, I see what you are saying. I tried to submit to the ASP page with:
http://sbw.airborne.com/SchedulePickup/SchedulePickupInfo.asp?F10052=1700 thinking that drop-down box 'Time your business closes' will display 5:00pm but it does not. I wonder how ASP page reads input parameters from the url?
[ August 21, 2003: Message edited by: Alex Kravets ]
 
Stephen Huey
Ranch Hand
Posts: 618
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't think that will work simply b/c in the HTML source for the page, you can see that each field's value is hardcoded like this:
value=""
So, it *seems* like a POST might get past that problem, but I don't even know for sure...
 
Alex Kravets
Ranch Hand
Posts: 476
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well the way I deal with drop-down boxes in my JSP page is by going thru value of drop-down box and comparing them to what I got from url. If they match I put selected next to the value of drop-down box and build drop-down box like that. Not sure what's going on in ASP.
 
Ranch Hand
Posts: 227
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are trying to post the values to the page that the user uses to enter them. You should be submitting them to the page that IT submits them to:
http://sbw.airborne.com/SchedulePickup/SchedulePickupInfo.asp?nav=
Then you'll be fine!
 
Stephen Huey
Ranch Hand
Posts: 618
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks--I'm nuts! I figured that out right at the end of the work day.
 
Hey cool! They got a blimp! But I have a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic