You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by quinquin2209 <qu...@yahoo.com.hk> on 2007/12/10 10:52:56 UTC

Getting form input from a page dynamically loaded into a tabbed panel

I have a page which has a tabbed panel and the content of each tab is
dynamically loaded from an external source as follow:

main.jsp
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head><s:head theme="ajax" debug="true"/></head>
<body>
    "http://localhost:8080/app/message/list.action</a 	
   <s:tabbedPanel id="test2" theme="simple" >
      <s:div id="1" label="ALL" theme="ajax" href="%{messageList}?id=a"
loadingText="Loading..." />
      <s:div id="1" label="ALL" theme="ajax" href="%{messageList}?id=b"
loadingText="Loading..." />
      <s:div id="1" 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. 

As you can see in the Main.jsp, I wanna a hyperlink at the top of the tabbed
panel. When it is clicked, I wanna pass the form input in the external page
for processing. 

How can I get the form input in the external page from the main.jsp? Is it
possible to do so??

Thanks in advance.
-- 
View this message in context: http://www.nabble.com/Getting-form-input-from-a-page-dynamically-loaded-into-a-tabbed-panel-tp14249989p14249989.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Getting form input from a remote tabbed panel

Posted by quinquin2209 <qu...@yahoo.com.hk>.
Thanks a lot. I understand it now.



Jeromy Evans - Blue Sky Minds wrote:
> 
> 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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Getting-form-input-from-a-remote-tabbed-panel-tp14249989p14269701.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Getting form input from a remote tabbed panel

Posted by Jeromy Evans <je...@blueskyminds.com.au>.
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