struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeromy Evans <jeromy.ev...@blueskyminds.com.au>
Subject Re: Getting form input from a remote tabbed panel
Date Mon, 10 Dec 2007 10:58:34 GMT
quinquin2209 wrote:
> I have a page which has a tabbed panel and all tab is remote tab:
>
> main.jsp
> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
> <head><s:head theme="ajax" debug="true"/></head>
> <body>
>    
>    <s:tabbedPanel id="test2" theme="simple" >
>       <s:div id="a" label="ALL" theme="ajax" href="%{messageList}?id=a"
> loadingText="Loading..." />
>       <s:div id="b label="ALL" theme="ajax" href="%{messageList}?id=b"
> loadingText="Loading..." />
>       <s:div id="c" label="ALL" theme="ajax" href="%{messageList}?id=c"
> loadingText="Loading..." />
>    </s:tabbedPanel>
> </body>
> </html>
>
> The external page loaded has a form where a list of checkbox of different
> value will be shown base on the id parameter. 
>   
By "external" page, I presume you mean the result that is fetched and 
loaded INTO each tab.
> Now I wanna put a input button at the top of the tab panel. When the button
> is pressed, it will pass the value in the form of external page to the
> action for further processing. 
> Is it possible to do so?? How can I get the form input from an external
> page?
>   
Yes.  The way to think about it is to focus on the imporant fact that 
there's only one document model (DOM). Unless you're using frames, there 
is really only one DOM that has been aggregated from multiple sources.  
Dojo does the work for you - fetching the html, parsing it, inserting it 
into the DOM and (if desired) executing the javascript within it.

The best way to visualise this is to install the Web Developer Toolbar 
into Firefox and use the View Generated Source button. This shows you 
the actual DOM (whereas, the default View Source only shows the original 
DOM).

With that in mind, the form outside your tab is on the same page (DOM) 
as the forms inside your tabs.  You just need to use some javascript to 
tie them together and document.getElementById(id) will work as too will 
document.formName.

If you want javascript inside a tab, don't forget to add the additional 
s:div parameters to ensure dojo doesn't strip it out. 

Hope that helps.
Jeromy Evans

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message