PDA

View Full Version : Work with php and need to send a variable of a tab1 to tab2 by url and load a form



operador
30 Jan 2008, 8:53 AM
do not speak English, using a translator, I am beginning to use the libraries of ext2 I was difficult because everything is in English, I need you to help me, please is as follows:

es con el TABPANEL quiero cambiar de tab atravez de un link

I am in a form I click on a link that takes me to necestito as I tab2
Work with php and need to send a variable of a tab1 to tab2 by url and instead load a form

this code

panel1.html


<html>
<head>
<script language="JavaScript" type="text/javascript" src="../funciones/javascript/funcionesJS.js"></script>
<script language="JavaScript" type="text/javascript" src="adapter/ext/ext-base.js"></script>
<script language="JavaScript" type="text/javascript" src="ext-all.js"></script>
<script language="JavaScript" type="text/javascript" src="examples/tabs/tabs.js"></script>
<link rel="stylesheet" type="text/css" href="resources/css/ext-all.css"/>
<style type="text/css">
.settings {background-image:url(examples/shared/icons/fam/folder_wrench.png);}
.nav {background-image:url(examples/shared/icons/fam/folder_go.png);}
</style>
</head>
<body>
<div id="west"></div>
<div id="north"></div>
<div id="south"></div>
</body>
</html>

tabs.js

function submitForm() {
// whatever javascript you need can go here...
var panel1 = Ext.getCmp('tab1');
var panel2 = Ext.getCmp('tab2');
panel2.myVar = panel1.myVar; // or whatever
}
function showTab(index) {
var tabs = Ext.getCmp('myTabPanel');
tabs.setActiveTab( tabs.items.getAt(index) );
}
Ext.onReady(function(){
Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
var viewport = new Ext.Viewport({
layout:'border',
items:[
new Ext.BoxComponent({ // raw
region:'north',
el: 'north',
height:32
}),{
region:'south',
contentEl: 'south',
split:true,
height: 100,
minSize: 100,
maxSize: 200,
collapsible: true,
title:'South',
margins:'0 0 0 0'
},{
region:'west',
id:'west-panel',
title:'PANEL',
split:true,
width: 200,
minSize: 175,
maxSize: 400,
collapsible: true,
margins:'0 0 0 5',
layout:'accordion',
layoutConfig:{
animate:true
},
items: [{ contentEl: 'west',
title:'ORDEN',
border:false,
iconCls:'nav'
},{
title:'CUENTAS',
html:'<p>Some settings in here.</p>',
border:false,
iconCls:'settings'

},{
title:'MANTENIMIENTO',
html:'<p>Some settings in here.</p>',
border:false,
iconCls:'settings'
}]
},

new Ext.TabPanel({
id:'myTabs',
region:'center',
//deferredRender:false,
activeTab:0,
plain:true,
defaults:{autoScroll: true},

items: [{ id: 'tab1',
title: 'Ingresar Orden',
autoLoad:'../medios/forms/formingresarorden.php'

},{
id: 'tab2',
title: 'Inspeccion General',
autoLoad:'../medios/forms/forminspeccion.php'
},{
id: 'tab3',
title: 'Evaluacion por Sistemas',
autoLoad:'../medios/forms/formevasistema.php'
},{
id: 'tab4',
title: 'Control Interno Hospitalizacion',
autoLoad:'../medios/forms/formhospitalizacion.php'
},{
id: 'tab5',
title: 'Control Farmacos Hospitalizacion',
autoLoad:'../medios/forms/formhospitalizacion.php'
}
]
})

// fin new Ext.TabPanel({
]

});

});

formingresarorden.php


<form name="Formu" action="">
...
<td><a href="#" onclick='javascript:showTab(2)'>view profile</a></td>
...

para
30 Jan 2008, 9:01 AM
Add Ids


items: [{
id: 'tab1',
title: 'Ingresar Orden',
autoLoad:'../medios/forms/formingresarorden.php'
},
....
{
id: 'tab5',
title: 'Control Farmacos Hospitalizacion',
autoLoad:'../medios/forms/formhospitalizacion.php'
}]




<button value="SendToTab" onClick="javascript:submitForm()"/>

function submitForm() {
// whatever javascript you need can go here...
var panel1 = Ext.getCmp('tab1');
var panel2 = Ext.getCmp('tab2');
panel2.myVar = panel1.myVar; // or whatever
}

para
30 Jan 2008, 12:10 PM
After getting a private message with more details... here's my new response.



new Ext.TabPanel({
id: 'myTabs', // add an id to the tabpanel
region:'center',
//deferredRender:false,
activeTab:0,
...............

<a href="#" onclick='javascript:showTab(2)'>view profile</a>

function showTab(index) {
var tabs = Ext.getCmp('myTabPanel');
tabs.setActiveTab( tabs.items.getAt(index) );
}

operador
30 Jan 2008, 12:47 PM
One cuestions, index is the form name or Referenacia ago to.. ?
the function Referenacia ago to TabPanel
this code:


function submitForm() {
// whatever javascript you need can go here...
var panel1 = Ext.getCmp('tab1');
var panel2 = Ext.getCmp('tab2');
panel2.myVar = panel1.myVar; // or whatever
}
function showTab(index) {
var tabs = Ext.getCmp('myTabPanel');
tabs.setActiveTab( tabs.items.getAt(index) );
}
Ext.onReady(function(){
Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
var viewport = new Ext.Viewport({
layout:'border',
items:[
new Ext.BoxComponent({ // raw
region:'north',
el: 'north',
height:32
}),{
region:'south',
contentEl: 'south',
split:true,
height: 100,
minSize: 100,
maxSize: 200,
collapsible: true,
title:'South',
margins:'0 0 0 0'
},{
region:'west',
id:'west-panel',
title:'PANEL',
split:true,
width: 200,
minSize: 175,
maxSize: 400,
collapsible: true,
margins:'0 0 0 5',
layout:'accordion',
layoutConfig:{
animate:true
},
items: [{ contentEl: 'west',
title:'ORDEN',
border:false,
iconCls:'nav'
},{
title:'CUENTAS',
html:'<p>Some settings in here.</p>',
border:false,
iconCls:'settings'

},{
title:'MANTENIMIENTO',
html:'<p>Some settings in here.</p>',
border:false,
iconCls:'settings'
}]
},

new Ext.TabPanel({
id:'myTabs',
region:'center',
//deferredRender:false,
activeTab:0,
plain:true,
defaults:{autoScroll: true},

items: [{ id: 'tab1',
title: 'Ingresar Orden',
autoLoad:'../medios/forms/formingresarorden.php'

},{
id: 'tab2',
title: 'Inspeccion General',
autoLoad:'../medios/forms/forminspeccion.php'
},{
id: 'tab3',
title: 'Evaluacion por Sistemas',
autoLoad:'../medios/forms/formevasistema.php'
},{
id: 'tab4',
title: 'Control Interno Hospitalizacion',
autoLoad:'../medios/forms/formhospitalizacion.php'
},{
id: 'tab5',
title: 'Control Farmacos Hospitalizacion',
autoLoad:'../medios/forms/formhospitalizacion.php'
}
]
})

// fin new Ext.TabPanel({
]

});

});

para
30 Jan 2008, 12:58 PM
Oops. Sorry.


new Ext.TabPanel({
id: 'myTabPanel', // add an id to the tabpanel
region:'center',
//deferredRender:false,
activeTab:0,
...............

<a href="#" onclick='javascript:showTab(2)'>view profile</a>

function showTab(index) {
var tabs = Ext.getCmp('myTabPanel');
tabs.setActiveTab( tabs.items.getAt(index) );
}


Use Code tags.
Use Code tags.
Use Code tags.
Use Code tags.
Use Code tags.
Use Code tags.

Use Code tags.

operador
31 Jan 2008, 2:30 PM
I want to make is that when you click on this link m sends a tab2


<a href="#">Orden de Registro</a>


The link is in a form php