• Post Reply Bookmark Topic Watch Topic
  • New Topic

Disable and enable one particular field

 
prathimaprasun rao
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello sir,
I have 6 different user accounts:administrator,datamanager,consultant,staff,strategic and authorized.
I want to enable the field "dhr_id" only for administrator and datamanager and disable for the remaining accounts.I have written the following code but could not enable the field for only those two accounts.
Could you just let me know what's wrong in the below code.

if (mode.equals("edit")) {
mode = "edit";
//archKey = userSession.getAC();
//out.println("ARCHKEY "+ archKey);
dhr_id = request.getParameter("dhr_id");
strSQL = "SELECT archaeology_pkey FROM archaeology WHERE dhr_id='" + dhr_id+"'";
if ((userProfile.equalsIgnoreCase("Data Managers")) || (userProfile.equalsIgnoreCase("Administrator")))
{
document.getElementById('dhr_id').disabled = false;
}
else
{
document.getElementById('dhr_id').disabled = true;
}
//out.println(strSQL);
Statement stmtSQL = conn.createStatement();
ResultSet rset = stmtSQL.executeQuery(strSQL);
while (rset.next()) {//begin while
archKey = rset.getString(1);
}//end while
rset.close();
stmtSQL.close();

Could any one provide the url where I can find the sample examples related to enabling and disabling particular fields?

Thanks,
Prathima
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65516
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this Java or JavaScript? It looks like you are mixing the two, which of course, you cannot do.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!