PDA

View Full Version : How to run scripts in when tab HTML is specified?



VishalKulkarni
1 Jul 2008, 11:09 PM
Hi
I am using Layout and Panel.

In one of the panel i am sending AJAX request to controller, in callback (req.responseText) i get HTML which contain script and some rendering tags of html.
i am assinging this callBack text to tabs html.
as result html get render properly but scripts not execute.

i can not use autoLoad={url:---,scripts:true}..

Regards,
Vishal

Animal
1 Jul 2008, 11:40 PM
Why not?

VishalKulkarni
2 Jul 2008, 12:54 AM
As I want to submit some input fields from one of the form Panel i can not use autoLoad.

we are submitting form using AJAX and in servlet we forward control to next JSP so we get JSP Html as callBack(JSP->servlet->JSP).

Animal
2 Jul 2008, 12:57 AM
I can't understand why you can't use autoLoad.

VishalKulkarni
2 Jul 2008, 1:08 AM
I have some data fields which is submitted to servlet and servlet will forward the resultant HTML to JSP again in form text.i assigned that text to html of my tabbed panel.so i can not autoLoad did i answer you doubt?
Ex:
var str=req.responseText;//this is from servlet consist of HTML as well as script
tab.add({id : 'demoID', title:'Demo TAB', html: str});

result :
will only display HTML elements scripts in that response is not getting executed.
i want both get executed.

VishalKulkarni
2 Jul 2008, 2:07 AM
Can you just demonstrate with example. U can use my above example?

Animal
2 Jul 2008, 2:10 AM
You will have to create the child item of the TabPanel and then load it.



var newTab = tab.add({
title: 'Demo TAB',
id: 'demoid'
});
tab.setActiveTab(newTab);
newTab.update(responseText, true);

VishalKulkarni
2 Jul 2008, 2:44 AM
Thanks autoload works at last...:P

pawan.v.jadhav
2 Jul 2008, 6:12 AM
we donot get the values we set on request....using request.setAttribute() in URL..
and update method is not available for tabPanel

Animal
2 Jul 2008, 6:36 AM
'on about?

pawan.v.jadhav
2 Jul 2008, 6:42 AM
Look Its very simple Flow.

I have one form in one panel
it contains 4 fields,
user enters value in these field...then clicks on submit...
I make ajax call...
In controller i get these values from request. using request.getParameter('"fieldName");
i process it.. assume i get ArrayList of Object as output which i set in request using request.setAttribute()...
then i forword request to new JSP in that JSP i read request parameter and render it...
in AJAX callBack i am getting HTML + SCRIPT ok now i want to load this HTML+SCRIPT in different panel .. ok. But How...?

and for TabPanel i did not found any update method...

devnull
2 Jul 2008, 6:47 AM
yourPanel.load({
url: 'some.url',
params: yourForm.getValues()
});

yes?

Animal
2 Jul 2008, 6:50 AM
You can't update a TabPanel!

What do you want to do, destroy all the tabs in it?