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

The following code is deprecated by W3C:

<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.

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.

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:

<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.

Dan,

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

Thanks.

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:

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.

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.)

OK that is the one combination where target is not allowed where the tag being targetted is.

(assuming a strict doctype)

We have you surrounded, put down the marquee and blink tags and step away from the animated GIF’s! :lol:

I usually like target=“_blank” and I kind of hope they make a replacement. :shifty: All though I do know that frames are bad and blah blah, and it was intended for frame-use. I just liked it. :smiley:

Using target=“_blank” is one way of making your page less accessible than it would be if you avoided using it.

I use (and it validates fine asXHTML 1.0 Strict):

<form method='get' action='target_here'>

where target is the file that will process the form, ie what target=‘a_target_here’ would do.

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.

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.

I was referring to felgall and the topic in question, target. :slight_smile:

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.

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.

The target attribute is deprecated for all element types, since its purpose was to be used within framesets and framsets are deprecated themselves.