Submit a form using an image (slight twist)

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Submit a form using an image (slight twist)

Post by Chris Corbyn »

Hi,

I'm writing a page with a form that submits to a page on another website (the UPS order tracker).
There are two ways to submit the single form. One is just the standard submit action and the other is with <input type="image".....

Each method of submitting gives a different output. [Using the image gives a detailed status, and a standard submit gives a sumary].

I need to add an action that submits the form using the image and not the default "Submit" button to send the form data since I want a page that repeats, at set intervals, the form submission to update the status.

I have no idea what the server side asp code looks like I just know that both actions give different outputs.

If i use onLoad="document.formName.submit()" as an example, the form submits ok but not the way it would if I had clicked the image (ie. I only get the summary - not the detailed status).

How do I make it submit through an event handler using the image method?

I'd post the code but there's no need... it's a just short form with <input type="image" src="image.jpg" name="myimage">, nothing more.

Thanks :-)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

post some code dude.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

I'm still toying around with the basic principle so there's no script so far but this how I've been trying it.

I need to change the function "doSubmitByImage()" so that it submits using the image and not the normal method.

Code: Select all

<scipt language="JavaScript">
<!-- Hide
function repeatSubmit() &#123;
    setInterval("doSubmitByImage()",90000)
&#125;
function doSubmitByImage() &#123;
    document.runform.submit()
&#125;
// -->
</script>
and in the body....

Code: Select all

<body onLoad="repeatSubmit()">
<form name="runform" action="http://wwwapps.ups.com/WebTracking/processRequest" method="post" target="main_frame">



<input TYPE="HIDDEN" NAME="sort_by" VALUE="status">
<input TYPE="HIDDEN" NAME="TypeOfInquiryNumber" VALUE="R">
<input TYPE="HIDDEN" NAME="SenderShipperNumber" VALUE="W16759">
<input TYPE="HIDDEN" NAME="ToPickupYear" VALUE="2004">
<input TYPE="HIDDEN" NAME="FromPickupYear" VALUE="2004">
<input TYPE="HIDDEN" NAME="DestinationPostalCode" VALUE="">
<input TYPE="HIDDEN" NAME="loc" VALUE="en_US">

<input TYPE="HIDDEN" NAME="FromPickupDay" VALUE="9">
<input TYPE="HIDDEN" NAME="NumberDetailLines" VALUE="1">
<input TYPE="HIDDEN" NAME="line1" VALUE="TrackDetailInfo,1ZW167590427422892,303906428002bb0300e34a46bdb1d7e686\,303906428002bb0300e34a46bdb1d7e486\,\,,,I,,20040914,15:58:19,SHANNON,,IE,,,,,,20040914,DURHAM,,GB,EXPRESS SAVER,7.00,KGS,1,,,,,mpts,EP,,,,,,,,,,,W16759,,,W16759,,,,,,,,I,,">
<input TYPE="HIDDEN" NAME="DestinationCountry" VALUE="">
<input TYPE="HIDDEN" NAME="FromPickupMonth" VALUE="9">
<input TYPE="HIDDEN" NAME="ToPickupDay" VALUE="15">
<input TYPE="HIDDEN" NAME="ToPickupMonth" VALUE="9">
<input TYPE="HIDDEN" NAME="ReferenceNumber" VALUE="***masked****">
<input TYPE="HIDDEN" NAME="InquiryNumber" VALUE="***masked***">
<input type="image" src="http://wwwapps.ups.com/img/en/btn_lnk_details.gif" WIDTH="44" HEIGHT="14" align="top" border="0" alt="Detail" name="tdts1">
</form>
All the junk is the form is not really relevant it's just the way I get it to submit that matters :-) Thanks for your help :D
Post Reply