SitePoint Sponsor

User Tag List

Results 1 to 19 of 19
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2008
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    form target="" is DEPRECATED. What is the replacement?

    The following code is deprecated by W3C:

    HTML Code:
    <form target="myframe">
    The "target" attribute allows you to execute the form in a new window or in a frame. I'm trying to pass form data inside a frame.

    What is the alternative valid HTML/XHTML replacement?

    I don't want to risk using deprecated tags.

    Thanks.

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Frameset pages themselves are deprecated... so if you're going to use frames despite that, you don't have an argument against using the target attribute.

  3. #3
    SitePoint Enthusiast
    Join Date
    Jul 2008
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    By the way, this is for an AJAX file upload. I'm well aware of rel="external" and the fact I can just use javascript onclick="func()"

    However, since I have to use:

    HTML Code:
    <input type="file" />
    I haven't quite figured out how to pass the file into Javascript/PHP for the AJAX file upload except with form target="myframe" so I'm hoping there's a valid replacement or Javascript workaround here.

  4. #4
    SitePoint Enthusiast
    Join Date
    Jul 2008
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dan,

    In that case, what would you recommend I do for an AJAX file upload?

    Thanks.

  5. #5
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I'd be practical and ignore the fact that frames are deprecated and use them anyway. And since I'm using iframes for my AJAXy file upload script, I wouldn't have a problem using the target attribute.

    :runs from the standards police:

  6. #6
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,810
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    The reason why target is deprecated is because frames are deprecated and frames are the only place where you need to be able to target a link. The rest of the time you should leave it up to your visitors as to what they want to open where.

    To use frames you need to use the frameset doctype which also allows target. To use iframes you need to use the transitional doctype which also allows target. The only doctype which doesn't allow target is the strict doctype which also expects you to not be using frames and to have replaced all your iframes with objects.

    So there is no conflict provided you use the appropriate doctype for what you are trying to do.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  7. #7
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,670
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The only doctype which doesn't allow target is the strict doctype which also expects you to not be using frames and to have replaced all your iframes with objects.

    So there is no conflict provided you use the appropriate doctype for what you are trying to do.
    <object> can act as an <iframe> -- you can submit to it with <form target>.

    In HTML5, both <iframe> and <form target> are valid. (But not framesets.)
    Simon Pieters

  8. #8
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,810
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by zcorpan View Post
    <object> can act as an <iframe> -- you can submit to it with <form target>.
    OK that is the one combination where target is not allowed where the tag being targetted is.

    (assuming a strict doctype)
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  9. #9
    Follow: @AlexDawsonUK silver trophybronze trophy AlexDawson's Avatar
    Join Date
    Feb 2009
    Location
    England, UK
    Posts
    8,111
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Dan Grossman View Post
    :runs from the standards police:
    We have you surrounded, put down the marquee and blink tags and step away from the animated GIF's!

  10. #10
    SitePoint Member aliceslipped's Avatar
    Join Date
    Dec 2008
    Location
    Massillon, OH
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I usually like target="_blank" and I kind of hope they make a replacement. All though I do know that frames are bad and blah blah, and it was intended for frame-use. I just liked it.
    (web development) blogging:
    never before have so many people had so little to say to so few
    {Lindsey Campbell
    ; Web Design & Development; SEO; Awesome;}

  11. #11
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,810
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Using target="_blank" is one way of making your page less accessible than it would be if you avoided using it.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  12. #12
    From space with love silver trophy
    SpacePhoenix's Avatar
    Join Date
    May 2007
    Location
    Poole, UK
    Posts
    5,014
    Mentioned
    103 Post(s)
    Tagged
    0 Thread(s)
    I use (and it validates fine asXHTML 1.0 Strict):

    HTML Code:
    <form method='get' action='target_here'>
    where target is the file that will process the form, ie what target='a_target_here' would do.
    Community Team Advisor
    Forum Guidelines: Posting FAQ Signatures FAQ Self Promotion FAQ
    Help the Mods: What's Fluff? Report Fluff/Spam to a Moderator

  13. #13
    Follow: @AlexDawsonUK silver trophybronze trophy AlexDawson's Avatar
    Join Date
    Feb 2009
    Location
    England, UK
    Posts
    8,111
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    And it interferes with how browser's deal with links by default, I consider it almost as intollerable as browser hijacking (yes I mean no right click scripts, disable selecting and all those other underhanded methods of breaking browser functionality).

  14. #14
    From space with love silver trophy
    SpacePhoenix's Avatar
    Join Date
    May 2007
    Location
    Poole, UK
    Posts
    5,014
    Mentioned
    103 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AlexDawson View Post
    And it interferes with how browser's deal with links by default, I consider it almost as intollerable as browser hijacking (yes I mean no right click scripts, disable selecting and all those other underhanded methods of breaking browser functionality).
    In what way(s)?

    I just looked up action on the w3c site and it looks like action is required.
    Community Team Advisor
    Forum Guidelines: Posting FAQ Signatures FAQ Self Promotion FAQ
    Help the Mods: What's Fluff? Report Fluff/Spam to a Moderator

  15. #15
    SitePoint Member aliceslipped's Avatar
    Join Date
    Dec 2008
    Location
    Massillon, OH
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by felgall View Post
    Using target="_blank" is one way of making your page less accessible than it would be if you avoided using it.
    Haha, I know. I was just saying.

    I definitely do avoid using it, I just like to idea of it: keeping the user on your page. But, I also understand that it's deprecated.
    (web development) blogging:
    never before have so many people had so little to say to so few
    {Lindsey Campbell
    ; Web Design & Development; SEO; Awesome;}

  16. #16
    Follow: @AlexDawsonUK silver trophybronze trophy AlexDawson's Avatar
    Join Date
    Feb 2009
    Location
    England, UK
    Posts
    8,111
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by SpacePhoenix View Post
    In what way(s)?

    I just looked up action on the w3c site and it looks like action is required.
    I was referring to felgall and the topic in question, target.

  17. #17
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by SpacePhoenix View Post
    I use (and it validates fine asXHTML 1.0 Strict):

    HTML Code:
    <form method='get' action='target_here'>
    where target is the file that will process the form, ie what target='a_target_here' would do.
    That's not the same thing. The action attribute specifies the URI of the script or application that will receive the submitted data. The deprecated target attribute specified in which frame the result returned from the action script would display. Much like the equally deprecated target attribute for links.
    Birnam wood is come to Dunsinane

  18. #18
    SitePoint Zealot bgil's Avatar
    Join Date
    Apr 2009
    Location
    So. California
    Posts
    124
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AlexDawson View Post
    And it interferes with how browser's deal with links by default, I consider it almost as intollerable as browser hijacking (yes I mean no right click scripts, disable selecting and all those other underhanded methods of breaking browser functionality).
    Is the target attribute depricated for all tags, or just form? I notice this forum uses the target attribute for links, such as signatures.

    Also, I'm wondering what percentage of web-surfers do not know how to manage clicking on links, to open in a new tab for example a link that would normally replace the current page.
    -Brad

  19. #19
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The target attribute is deprecated for all element types, since its purpose was to be used within framesets and framsets are deprecated themselves.
    Birnam wood is come to Dunsinane


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •