Thank you both for your help. Much Appreciated. T.
-----Original Message----- From: Scott Cadillac [mailto:[EMAIL PROTECTED]] Sent: 27 May 2002 05:53 PM To: Multiple recipients of list witango-talk Subject: Re: Witango-Talk: ARG - Form Image Button Hi Henning, Don't short-change yourself - next to XML and HTML, JavaScript can be Witango's best friend :-). With respect to Intranet Applications and MSIE - JavaScript (JScript) is very powerful and can make your web-pages do stuff you never thought possible. With respect to large scale Applications on a busy site - JavaScript can make a major difference in site performance by minimizing the number of unnecessary trips you make to the server for adjusting your presentation layer. It may be a long investment in time and learning - I'm still learning something about it everyday, just like Witango - but it's a good investment. Hi Trevor, There are number of different ways to use JavaScript, and if what you are trying to do is a simple check if a field is empty prior to submitting, this is what I would do: <FORM NAME=inputform METHOD="POST" ACTION="<@CGI><@APPFILE>?_function=insert&<@UserReferenceArgument>" onSubmit="if(document.inputform.name.value ==''){alert('Name field is empty.'); return false;}else{return true;}"> Name: <INPUT NAME="name" TYPE=TEXT SIZE=40 MAXLENGTH=200 VALUE=""> <A href="javascript:document.inputform.reset();"><img src="a.gif" border=0></a> <INPUT TYPE="SUBMIT" VALUE="SUBMIT IT"> </FORM> Your previous example seamed to be missing the code for the 'verify(this)' function as well as the submit action. If you were just relying on the user hitting [Enter], then keep in mind this doesn't work for most versions of Netscape. Hope this helps. Cheers... Scott Cadillac http://xml-extra.net [EMAIL PROTECTED] VP, Research and Development Plus International Corp. 604-460-1843 [EMAIL PROTECTED] http://www.plusinternational.com Vancouver, BC, Canada Does your company have an Enterprise Information Portal? Check out Salsa at www.plusinternational.com/flash/salsa.htm ----- Original Message ----- From: Henning Sittler To: Multiple recipients of list witango-talk Sent: Monday, May 27, 2002 8:01 AM Subject: RE: Witango-Talk: ARG - Form Image Button Well: 1) <RANT> I don't need to say it, but I stay as far away from javascript as I can. I have to use, but I only use when I have to. Let the server side scripts handle as much as possible for the most reliable results. </RANT> 2) onClick should work for the form image being used as your submit button. <input type=image name=submitimage onClick="javascript: dosomething();"> But I may be wrong since I rarely use js. It's a silly language, awkward and inconsistent. Henning Sittler www.inscriber.com -----Original Message----- From: Trevor Green [mailto:[EMAIL PROTECTED]] Sent: Monday, May 27, 2002 10:50 AM To: Multiple recipients of list witango-talk Subject: RE: Witango-Talk: ARG - Form Image Button This is great, but how do you get it to execute some javascript when the form is submitted, eg <FORM NAME=inputform METHOD="POST" ACTION="<@CGI><@APPFILE>?_function=insert&<@UserReferenceArgument>" onSubmit=" this.name.required = true; return verify(this); "> Name: <INPUT NAME="name" TYPE=TEXT SIZE=40 MAXLENGTH=200 VALUE=""> <A href="javascript:document.inputform.reset();"><img src="a.gif" border=0></a> </FORM> Submits the form but does not do the "onSubmit" stuff. Regards Trevor -----Original Message----- From: James Macfarlane [mailto:[EMAIL PROTECTED]] Sent: 22 May 2002 11:14 PM To: Multiple recipients of list witango-talk Subject: RE: Witango-Talk: ARG - Form Image Button Input type=image is buggy, you're best to avoid it and use: <A href="javascript:document.Form1.reset();"><img src="a.gif" border=0></a> -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Henning Sittler Sent: Wednesday, May 22, 2002 1:13 PM To: Multiple recipients of list witango-talk Subject: Witango-Talk: ARG - Form Image Button I can't for the life of me figure out what I'm missing here. I'm including some source code and explanation, so this will be a lengthy question. Skip to: ** THE PROBLEM ** to save time. I'd like to use a Reset button on a form, but using <input type=image> so that I don't have to use an ugly grey form button. My Submit image button works great. In fact, the Reset button works too, but it doesn't reset anything, it acts just like the Submit button. So I added code to detect a click on the reset button specifically. My form images are defined on the input form HTML page as: <INPUT TYPE=IMAGE NAME="reset" SRC="/assets/siteimages/reset.gif" ALT="Reset" BORDER=0> <INPUT TYPE=IMAGE NAME="step" SRC="/assets/siteimages/step-billinginformation.gif" ALT="Billing" BORDER=0> Clicking on the reset form image button results in defined x,y image pixel coordinate values being defined and saved in <@ARG reset.x> and <@ARG reset.y> I figure I can just check for <@ARG reset.x>, and see if it has a defined length. If it does, then the rest button has been clicked, and I should use an HTTP Redirect to reload the form input page. ** THE PROBLEM ** When I click the reset button, my code does detect this, but the HTTP Redirect does not occur. Meanwhile, subsequent statements commanding an HTTP Redirect (located in either the same window or subsequent actions) function as expected. The state containing the first function call comanding an HTTP Redirect is a cut and paste copy of the second one seen below, as they should both do the same thing, but the first one should trigger sooner if the Reset button was clicked instead of the Submiot button. This is code borrowed from the T2K Storefront demo, and modified by me. user$resetx is used only for visual display to the HTML output so I can do my own checking manually. #### Results HTML #### <@EXCLUDE> <@PURGE user$resetx> <@ASSIGN user$resetx Value="<@LENGTH STR='<@ARG reset.x>'>"> </@EXCLUDE> <@IF "<@LENGTH STR='<@ARG reset.x>'>"> <@ASSIGN user$resetx Value="h2"> <@CALLMETHOD application$Common "HTTPRedirect('<@VAR application$CGI><@VAR application$RootPath>Order/Shipping.taf?_function=input&<@USERREFERENCEA RGUM ENT>')"> </@IF> <@EXCLUDE> <@COMMENT> <@IF "LEN(<@ARG reset.x>)" TRUE="<@ASSIGN user$resetx Value='<@VAR user$resetx> - LEN(<@ARG reset.x>)'>" FALSE=""> <@IF "<@CALC EXPR=LEN(<@ARG reset.x>)> > 0" TRUE="<@ASSIGN user$resetx Value='<@VAR user$resetx> - LEN(<@ARG reset.x>)'>" FALSE=""> <@ASSIGN user$resetx Value=<@LENGTH STR="<@ARG reset.x>">> </@COMMENT> <@! "Track all entered or changed values for user so they dont have to enter them again" > <@ASSIGN user$ArgShipToName "<@ARG ShipToName>"> <@ASSIGN user$ArgShipToCompany "<@ARG ShipToCompany>"> <@ASSIGN user$ArgShipToAddressLine1 "<@ARG ShipToAddressLine1>"> <@ASSIGN user$ArgShipToAddressLine2 "<@ARG ShipToAddressLine2>"> <@ASSIGN user$ArgShipToAddressLine3 "<@ARG ShipToAddressLine3>"> <@ASSIGN user$ArgShipToCity "<@ARG ShipToCity>"> <@ASSIGN user$ArgShipToState "<@ARG ShipToState>"> <@ASSIGN user$ArgShipToZip "<@ARG ShipToZip>"> <@ASSIGN user$ArgShipToCountry "<@ARG ShipToCountry>"> <@ASSIGN user$ArgShipToPhone "<@ARG ShipToPhone>"> <@ASSIGN user$ShipToResult "BadField"> <@COMMENT> SET <@VAR user$ShipToResult> = "BadField" until it passes all the checks below. If it does not pass the checks, redirect back to the main input form again. </@COMMENT> <@IF "!LEN(<@ARG ShipToName>) OR LEN(<@ARG ShipToName>) > 100"> <@ASSIGN user$FieldName "you name"> <@ASSIGN user$FieldLength "100"> <@ELSEIF "!LEN(<@ARG ShipToAddressLine1>) OR LEN(<@ARG ShipToAddressLine1>) > 100"> <@ASSIGN user$FieldName "your address"> <@ASSIGN user$FieldLength "100"> <@ELSEIF "!LEN(<@ARG ShipToCity>) OR LEN(<@ARG ShipToCity>) > 100"> <@ASSIGN user$FieldName "your city"> <@ASSIGN user$FieldLength "100"> <@ELSEIF "!LEN(<@ARG ShipToPhone>) OR LEN(<@ARG ShipToPhone>) > 100"> <@ASSIGN user$FieldName "your shipping address phone number"> <@ASSIGN user$FieldLength "100"> <@ELSEIF "!LEN(<@ARG ShipToCountry>)"> <@ASSIGN user$ShipToResult "NoCountry"> <@ELSEIF "!LEN(<@ARG ShipToState>) AND ('<@ARG ShipToCountry>' = 'US' OR '<@ARG ShipToCountry>' = 'CA')"> <@ASSIGN user$ShipToResult "NoState"> <@ELSEIF "<@LENGTH STR='<@ARG reset.x>'>"> <@COMMENT> Double checking for the Reset button here, but this also fails to trigger the appropriate redirect below. </@COMMENT> <@ASSIGN user$ShipToResult "Reset"> <@ASSIGN user$resetx Value=1> <@PURGE user$ArgShipToName> <@ELSE> <@PURGE user$ShipToResult> <@PURGE user$FieldName> <@PURGE user$FieldLength> </@IF> </@EXCLUDE> <@IF "LEN(<@VAR user$ShipToResult>)"> <@! "Return to input form" > <@CALLMETHOD application$Common "HTTPRedirect('<@VAR application$CGI><@VAR application$RootPath>Order/Shipping.taf?_function=input&<@USERREFERENCEA RGUM ENT>')"> <@COMMENT> </@COMMENT> </@IF> #### End Results HTML #### The second (last) HTTP Redirect called here does function properly if the other fields checkout OK. It does not function properly if the reset button was pressed and reset.x has a value, which should also mean that <@LENGTH STR='<@ARG reset.x>'> has a value, which should cause <@ASSIGN user$ShipToResult "Reset">. Feel free to email me privately. Thanks in advance for any help. Henning Sittler www.inscriber.com ________________________________________________________________________ TO UNSUBSCRIBE: send a plain text/US ASCII email to [EMAIL PROTECTED] with unsubscribe witango-talk in the message body ________________________________________________________________________ TO UNSUBSCRIBE: send a plain text/US ASCII email to [EMAIL PROTECTED] with unsubscribe witango-talk in the message body
