2013-09-15 7 views
1

У меня есть эта вкладка с четырьмя различными текстовыми полями и двумя аналогичными кнопками отправки. Форма используется покровителями для входа в свою библиотечную учетную запись. Проблема возникает, когда кто-то пытается войти в систему с использованием текстовых полей на одной вкладке, не увенчался успехом и переходит к логину, используя текстовые поля на другой вкладке. Когда покровители пытаются войти в оба пути, информация из их последней неудачной попытки не очищается. Когда вы переключаетесь между двумя разными зонами входа, как я могу удалить введенную пользователем информацию?очистить определенные текстовые поля в виде вкладок

function tabSwitch(new_tab, new_content) { 
document.getElementById('ldap_login').style.display='none'; 
document.getElementById('barcode_login').style.display='none'; 
document.getElementById(new_content).style.display='block'; 

document.getElementById('ldap_tab').className=''; 
document.getElementById('barcode_tab').className=''; 
document.getElementById(new_tab).className='active'; 
} 

<div id=" " class="tabbed_area"> 
<form name="patform" method="POST"> 

<ul id="tabs"> 
<li><a href="javascript:tabSwitch('ldap_tab', 'ldap_login');" id="ldap_tab" class="active">Active students, faculty, and staff</a></li> 
<li><a href="javascript:tabSwitch('barcode_tab', 'barcode_login');" id="barcode_tab">Community, alumni, emeriti, and others</a></li> 
</ul> 

<div id="ldap_login" class="content"> 
Clemson Username: <br /> 
<input type="text" name="extpatid" id="extpatid" value="" size="20" maxlength="40"> 
Your iRoar, Blackboard, etc., username <br/> 
Password:* <br /> 
<input name="extpatpw" id="extpatpw" type="text" value="" size="20" maxlength="40"> 
*Passwords cannot contain the special characters <and>. <br /><br /> 
<input type="image" src="/screens/pat_submit.gif" border="0" name="" value="submit"> 
</div> 

<div id="barcode_login" class="content"> 
Last Name: <br /> 
<input type="text" name="name" id="name" value="" size="20" maxlength="40"> 
For example, type "Smith." <br /> 
Barcode: <br /> 
<input name="code" id="code" type="text" value="" size="20" maxlength="40"> 
Type the letter plus 10 digit number located on the back of your TigerOne ID card (or 9 digit number plus "1" for old library cards).<br /><br /> 
<input type="image" src="/screens/pat_submit.gif" border="0" name="" value="submit"> 
</div> 

</form> 
</div> 

ответ

0

Оберните свои 2 вкладки в свои собственные формы. Таким образом, отправители будут принимать входные данные только со своих соответствующих вкладок и игнорировать все, что находится на другой вкладке.

<div id="ldap_login" class="content"> 
<form> 
    Clemson Username: <br /> 
    <input type="text" name="extpatid" id="extpatid" value="" size="20" maxlength="40"> 
    Your iRoar, Blackboard, etc., username <br/> 
    Password:* <br /> 
    <input name="extpatpw" id="extpatpw" type="text" value="" size="20" maxlength="40"> 
    *Passwords cannot contain the special characters <and>. <br /><br /> 
    <input type="image" src="/screens/pat_submit.gif" border="0" name="" value="submit"> 
</form> 
</div> 

Etc ..

Смежные вопросы