how to get back the target

J

john woo

Hi

I'm stuck on setting a target for current page. say, the following
function is called

function Call_OnClick(index, nValue, PageID, TargetFrameID)
{
document.InputForm.PAGEID.value = PageID;
if ( TargetFrameID != null )
document.InputForm.target = '_new';
document.InputForm.submit();
}

to open another broswer. after this, the parent GUI doesn't display all
the component, few of bottons are gone. without exacuting the above
function, all are fine. I think it's the target setting problem (all
pages are governed by controller in this project).

Can anyone tell about this issue?
 
J

Jc

john said:
Hi

I'm stuck on setting a target for current page. say, the following
function is called

function Call_OnClick(index, nValue, PageID, TargetFrameID)
{
document.InputForm.PAGEID.value = PageID;
if ( TargetFrameID != null )
document.InputForm.target = '_new';
document.InputForm.submit();
}

to open another broswer. after this, the parent GUI doesn't display all
the component, few of bottons are gone. without exacuting the above
function, all are fine. I think it's the target setting problem (all
pages are governed by controller in this project).

Can anyone tell about this issue?

How is the "parent GUI" being displayed? Is a frameset being used?
There's not enough information given for me determine why your parent
GUI isn't showing up in the new page (I think that is what you are
expecting), but if it isn't, it is because whatever URL you are
submitting to isn't returning what you expect (if your page is
generated server-side), or whatever code you are expecting to run to
generate your "parent GUI" isn't being executed on this new page.

Do you mean to use "_blank" instead of "_new"? AFAIK, "_new" doesn't
have any special meaning, and will simply open up a new window named
"_new", unless a window with a name of "_new" already exists, in which
case it will be used as the form target.

http://msdn.microsoft.com/library/d.../author/dhtml/reference/properties/target.asp
 
D

David Dorward

Jc said:
Do you mean to use "_blank" instead of "_new"? AFAIK, "_new" doesn't
have any special meaning

_new isn't allowed as a target name and causes browsers to perform error
recovery. Some may treat it as _blank, some may treat it as a name with no
special features.
 
J

john woo

It's embeded inside a JSP. a controller handles all the URL. the parent
GUI built in a basic template, which provides a buttons bar. the above
function

document.InputForm.target = '_new';
document.InputForm.submit();

let the controler knows a new page requested and the
controler(server-side,servlet server engine) pops up another JSP
(DHTML, with java-code,HTML and javascript).

after this pop up, it seemed the controler lose some info about the
parent GUI, didn't sent back the buttons on the bar.

without executing the above function, all are fine
 
J

Jc

john said:
It's embeded inside a JSP. a controller handles all the URL. the parent
GUI built in a basic template, which provides a buttons bar. the above
function

document.InputForm.target = '_new';
document.InputForm.submit();

let the controler knows a new page requested and the
controler(server-side,servlet server engine) pops up another JSP
(DHTML, with java-code,HTML and javascript).

after this pop up, it seemed the controler lose some info about the
parent GUI, didn't sent back the buttons on the bar.

without executing the above function, all are fine

It sounds like your form needs to send some more info back to your
controller, perhaps there is some state info it needs that isn't being
posted back? Some URL parameters perhaps? You can add hidden inputs to
include this information in the popup request to the server. Also,
don't forget to change '_new' to '_blank', which may or may not be part
of the problem.
 
J

john woo

Thanks.

but what's the info I need?
and how to send back to the control (I just know how to forward tothe
next page by submitting, this NEXT page is controller/configured by
main frame controller)?

I've tried replace '_new' with '_blank', but the controller couldn't
regconize it. Plus, this GUI is a small part in the whole GUI, I don't
even the whole architect.
 
J

Jc

john said:
but what's the info I need?
and how to send back to the control (I just know how to forward tothe
next page by submitting, this NEXT page is controller/configured by
main frame controller)?

I have no idea what the controller needs to display the GUI properly,
I'm just guessing that maybe it needs additional parameters or state
info passed to it. You could get an idea by looking at the URL
parameters (if any) on the main page that is spawning the popup.

As I mentioned in my last post, one way to send additional get/post
parameters is to use a hidden input, refer to your favorite HTML
documentation.

I'm not familiar with jsp, perhaps you should ask this question in a
java related group, as it is not really a javascript question/problem.
 
T

Thomas 'PointedEars' Lahn

David said:
_new isn't allowed as a target name
Pardon?

and causes browsers to perform error recovery.

Which browser is that badly b0rken that it does not allow for any target
name?
Some may treat it as _blank,

Again, which browsers are you talking about?
some may treat it as a name with no special features.

Which is correct, and I can see no harm in that. What's your point, anyway?


PointedEars
 
T

Thomas 'PointedEars' Lahn

David said:

Hmmm, yes, you're right. However, the HTML 4.01 Transitional DTD says

| <!ENTITY % FrameTarget "CDATA" -- render in this frame -->
| [...]
| target %FrameTarget; #IMPLIED -- render in this frame --

It appears that many (most?) UA vendors never read or took heed of that
part of the specification, only of the DTD. Unfortunately , "_new" is
perfectly valid CDATA and so straightforward markup validation does not
show it as an error. What a junk! -- Why did they not specify

<!ENTITY % SpecialTarget "_blank|_self|_parent|_top" -- special targets -->
<!ENTITY % FrameTarget "%SpecialTarget; | NAME" -- render in this frame -->

in the first place? :-(
How can a browser be broken if it can't cope with a document including
something expressly forbidden? And which bit of "error recovery" did you
miss anyway?

ACK, ACK. Although switched from "_new" to "_blank" (and then often from
"_blank" to no `target' attribute) long ago, apparently I missed that part
all the years, too. Thank you very much for pointing out!
No it isn't, the browser is supposed to ignore it altogether.

ACK, ACK. However, many (most?) do not. But I agree that we should not
depend on that.


PointedEars
 
D

David Dorward

Thomas said:
Hmmm, yes, you're right. However, the HTML 4.01 Transitional DTD says

DTDs can only express certain constraints, you have to read the prose for
any specification.
<!ENTITY % SpecialTarget "_blank|_self|_parent|_top" -- special targets
--> <!ENTITY % FrameTarget "%SpecialTarget; | NAME" -- render in this
frame -->

So "_blank", "_self", "_parent", "_top" OR a NAME token ... which would
include "_new"? :)
 
T

Thomas 'PointedEars' Lahn

David said:
DTDs can only express certain constraints, you have to read the prose for
any specification.

I already knew that, you should at least bother to try to read and
understand what I wrote.
So "_blank", "_self", "_parent", "_top" OR a NAME token ...
Yes.

which would include "_new"? :)

No. NAME tokens, in contrast to CDATA tokens, must begin with a
letter which in combination with the other values would both apply
to the specification's prose and allow for markup validation against
forbidden values, in contrast to the current DTD. For consistency,
the `name' attribute of `frame' elements should then be of type NAME,
too.

<http://www.w3.org/TR/html4/types.html#h-6.2>


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,681
Members
48,796
Latest member
Greg L.

Latest Threads

Top