html - Change button text on submit with velocity engine / java -
so got admin panel website decided try small things not getting there yet.
so whenever disable or enable user nice good/bad notification saying happened ofcourse button stay same. way change according function?
#parse("/velocity/layout.vm") #@mainlayout() <table id="adminpanel"> <tr> <th>email</th> <th>name</th> <th>reset password</th> <th>isactive</th> <th>delete</th> </tr> #if($resetpassword) <p class="good notification">$msg.get("reset_password")</p> #elseif($blockuser) <p class="bad notification">$msg.get("block_user")</p> #elseif($unblockuser) <p class="good notification">$msg.get("unblock_user")</p> #elseif($deleteuser) <p class="bad notification">$msg.get("delete_user")</p> #end #foreach($user in $users) #if($user.getisadmin()) <div class="col"> <tr> <th>$user.getemail()</th> <th>$user.getfirstname() $user.getsurname()</th> <th><form method="post"> <input type="hidden" name="post" value="reset"> <input type="hidden" name="email" value="$user.getemail()"> <input type="submit" value="reset password" disabled> </form></th></th> <th><form method="post"> <input type="hidden" name="post" value="block"> <input type="hidden" name="email" value="$$user.getemail()"> <input type="submit" value="isactive" disabled> </form></th></th> <th><form method="post"> <input type="hidden" name="post" value="delete"> <input type="hidden" name="email" value="$user.getemail()"> <input id="button" type="submit" value="delete" disabled> </form></th> </tr> </div> #else <div class="col"> <tr> <th>$user.getemail()</th> <th>$user.getfirstname() $user.getsurname()</th> <th><form method="post"> <input type="hidden" name="post" value="reset"> <input type="hidden" name="email" value="$user.getemail()"> <input type="submit" value="reset password"> </form></th></th> <th><form method="post"> <input type="hidden" name="post" value="block"> <input type="hidden" name="email" value="$user.getemail()"> <input type="submit" value="disable"> </form></th></th> <th><form method="post"> <input type="hidden" name="post" value="delete"> <input type="hidden" name="email" value="$user.getemail()"> <input type="submit" value="delete"> </form></th> </tr> </div> #end #end </table> #end
it unclear in question buttons want text changed. since see 2 buttons in code, can recommend (assuming user
object has enough details know whether user blocked or not).
<input type="button" #if ($user.isblocked()) value="unblock" #else value="block" #end>
Comments
Post a Comment