[FX.php List] FMSkipRecords

Kevin Futter kfutter at sbc.melb.catholic.edu.au
Mon Mar 27 16:22:07 MST 2006


On 28/3/06 10:19 AM, "Kevin Futter" <kfutter at sbc.melb.catholic.edu.au>
wrote:

> On 28/3/06 9:46 AM, "Steve Hannah" <shannah at sfu.ca> wrote:
> 
>> 
>> On 27-Mar-06, at 2:23 PM, Kevin Futter wrote:
>> 
>>>> 
>>>> <FORM NAME="sub" METHOD="POST" ACTION="file.php">
>>>> <input type="hidden" id="data" name="data" value="mydata">
>>>> </FORM>
>>>> <a href="javascript:void(0)"
>>>> ONCLICK="document.sub.submit(); return false;"
>>>> target="_blank">LINK TEXT HERE</a>
>>>> 
>>>> This puts a simple form (add hidden elements for any data that you
>>>> want
>>>> to shepherd into the next form submission) right before the link that
>>>> will use it. Tested in Safari, Firefox (Mac), and IE6.
>>>> 
>>>> Cheers,
>>>> dan
>>> 
>>> Just a quick note about the JavaScript here: please avoid the
>>> "javascript:"
>>> pseudo protocol; it's invalid and clunky,
>> Not sure in what way this is invalid.
>> Clunky?  Sounds like personal taste (although  many web developers
>> share this personal taste).
>> 
>> 
>>> and in your example, not even
>>> necessary. The "return false" should be sufficient.
>> 
>> True
>>> Of course, the form will
>>> fail completely if JS is disabled or unavailable.
>>> 
>>> Additionally, if you're going to use hrefs, they should point a
>>> legitimate
>>> URI. If no such thing exists for your purpose, then you can simply
>>> use the
>>> onclick handler on a more appropriate element, such as <span> or
>>> even <p>.
>> I agree with the spirit of this comment (not using the wrong tag for
>> the wrong job), but in this case an <a href> is the most appropriate
>> tag because this IS a link.  You click it, and it takes you to
>> another page.  Clearly this is NOT a paragraph (p) and it is not just
>> a span of text ... it is a link and thus should be represented by an
>> href.
> 
> Actually, technically it's not a link as it doesn't contain or point to a
> valid URI. It's simply a mechanism to make the thing "clickable", and JS
> does the rest - it's just a JavaScript trigger. Why not just use a standard
> "submit" button, with an onclick handler in the form attributes? eg:
> 
> <FORM NAME="sub" METHOD="POST" ACTION="file.php" onclick="jsFunction();
> return false;">
> ...
> <input type="submit" value="Button Title">
> ...
> </form>
> 
> This is a much more standards-friendly approach, and pretty much how it
> should be done these days.

Replying to my own post here, but the JS handler in the form attributes
should of course be "onsubmit"!

D'Oh!

-- 
Kevin Futter
Webmaster, St. Bernard's College
http://www.sbc.melb.catholic.edu.au/





More information about the FX.php_List mailing list