Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi to all.

 

I have this code in javascript

 

var panels = new Array('panel1', 'panel2', 'panel3', 'panel4');

var selectedTab = null;
function showPanel(tab, name)
{
if (selectedTab)
{
	selectedTab.style.backgroundColor = '';
	selectedTab.style.paddingTop = '';
	selectedTab.style.paddingBottom = '';
}
selectedTab = tab;
selectedTab.style.backgroundColor = 'white';
selectedTab.style.paddingTop = '6px';

for(i = 0; i < panels.length; i++)
{
	document.getElementById(panels[i]).style.display = (name == panels[i]) ? 'block':'none';
}

return false;
}

 

this code alows me to have a simple tab implementation. I then have a series of DIV that alow me tro control the tabs

 

<div class="panel" id="panel1" style="DISPLAY: none">
<td>Nome da Campanha:</td>
<td><asp:textbox id="txtPromoName" runat="server"></asp:textbox></td>
<td><asp:requiredfieldvalidator id="valPromoName" Display="Dynamic" EnableViewState="False" ErrorMessage="Preencha o campo" ControlToValidate="txtPromoName" Runat="server"></asp:requiredfieldvalidator></td>
</div>

<div class="panel" id="panel2" style="DISPLAY: none">
   ...
</div>

<div class="panel" id="panel3" style="DISPLAY: none">
   ...
</div>

<div class="panel" id="panel4" style="DISPLAY: none">
   ...
</div>

 

What i'm doing is there are validators in all div's and when there is an error i need to jump to to that div and to show the error. for examle let imagin that a user is filling the form in tab1 and submits the form, there is an error in tab3. So i wanna change the tab to tab3. here the code i have so far

 

function CheckValidatorErrors() 
{
var val
var parent = null;
for(i=0;i< Page_Validators.length;i++) 
{ 					
	if (!Page_Validators[i].isvalid)
	{
		val = Page_Validators[i];
               
                          //This the part that i'm missing
                          //Find the div that val is in and call
                          // the function showPanel
                        }
}
}

 

 

any ideias on how to do this?

 

thx to all

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...