Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Button Disable

Status
Not open for further replies.

extempore

Programmer
Jun 1, 2001
71
US
Hi,

I have this code which displays the Next and Prev button. There is a check made before calling the Javascript to see if the page before or after exist based on the pageindex. If the page do not exist then even if the user clicks the button nothing will happen. This is what I need. But now the user wants to disable or even make the button invisible if the next or prev page do not exist. I think it can be achieved with the same logic used here but can you guys help me how to rewrite the disable or invisible logic based on this. Thanks for your help.

<tr>
<td align=left>
<input type=&quot;button&quot; value=&quot;Previous&quot; <%=pageIndex>0?&quot;onClick='prevPage()'&quot;:&quot;&quot;%>>
</td>
<td align=right>
<input type=&quot;button&quot; value=&quot;Next&quot; <%=(size/10)==pageIndex?&quot;&quot;:&quot;onClick='nextPage()'&quot;%>>
</td>
</tr>
 
You mean something like this?

<tr>
<td align=left>
<input type=&quot;button&quot; value=&quot;Previous&quot; <%=pageIndex>0?&quot;onClick='prevPage()'&quot;:&quot;disable&quot;%>>
</td>
<td align=right>
<input type=&quot;button&quot; value=&quot;Next&quot; <%=(size/10)==pageIndex?&quot;disable&quot;:&quot;onClick='nextPage()'&quot;%>>
</td>
</tr>

Adam
 
hidden:

<tr>
<td align=left>
<input type=&quot;button&quot; value=&quot;Previous&quot; <%=pageIndex>0?&quot;onClick='prevPage()'&quot;:&quot;style='visibility:hidden;'&quot;%>>
</td>
<td align=right>
<input type=&quot;button&quot; value=&quot;Next&quot; <%=(size/10)==pageIndex?&quot;style='visibility:hidden;'&quot;:&quot;onClick='nextPage()'&quot;%>>
</td>
</tr>


or disabled:


<tr>
<td align=left>
<input type=&quot;button&quot; value=&quot;Previous&quot; <%=pageIndex>0?&quot;onClick='prevPage()'&quot;:&quot;disabled='disabled'&quot;%>>
</td>
<td align=right>
<input type=&quot;button&quot; value=&quot;Next&quot; <%=(size/10)==pageIndex?&quot;disabled='disabled'&quot;:&quot;onClick='nextPage()'&quot;%>>
</td>
</tr>

=========================================================
try { succeed(); } catch(E) { tryAgain(); }
-jeff
 
Hi,

Something like this but the button is still enabled for some reason. I know the logi works right becos when I press Next when there are more records it takes me to the next page and if there are no records it doesnt do it. So the logic works ok but the code you sent me compiled but it did not disable the button for some reason. Can you help me. thanks.
 
jemminger - Thanks for ur code it worked. Adam I appreciate your help too. Thanks a bunch.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top