This topic is locked
[SOLVED]

 Hide "Add New"

4/4/2018 6:23:02 PM
ASPRunner.NET General questions
I
i.NoLim author

Hello I have a form that asks for the user's address.
There are 4 fields:

  1. StreetNumber - Text field
  2. StreetName - Lookup field with the option to add new values on the fly
  3. City - Lookup field
  4. Apt/Suite - Text field



What I'm looking to do is: if the user selects 'Vegas' as the city, the option to add a new "StreetName" should be disabled/hidden; else it should be enabled/shown.
Additionally, I don't need this at the moment but might in the future, is there a way to disable/hide the option to add new entries to a table based on the user logged in?


I was thinking it should be a JavaScript OnLoad event,



ctrlCity.on('change', function(e)

{

if (this.getValue() == 'Vegas')

{

addnew_value_Street_Name_1.hide();

}

else

{

addnew_value_Street_Name_1.show();

}

}


The problem is that I'm not sure what goes in the if/else statements.

admin 4/5/2018

You won't be able to hide 'Add new' using Javascript API because it is only designed to hide the whole control. You can hide it using jQuery though:

http://api.jquery.com/hide/
Also 'Add new' will be hidden if current user doesn't have permissions to add records to the Lookup table.

I
i.NoLim author 4/17/2018



You won't be able to hide 'Add new' using Javascript API because it is only designed to hide the whole control. You can hide it using jQuery though:

http://api.jquery.com/hide/
Also 'Add new' will be hidden if current user doesn't have permissions to add records to the Lookup table.



I think I will be using your second recommendation once I figure out how to use permissions properly. Thank you!