hide field on "add new record" page

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
jinxy45
Posts: 12
Joined: 2014-09-09 11:20

hide field on "add new record" page

Post by jinxy45 » 2020-09-25 16:09

Hi, I've recently added a new field called "Link" and in "add new record" view it displays in the place where "notes" used to be. A client continues to place notes in the new field, and not further down in the page where" notes" has moved to. Is it possible to hide the "Link" field on the "add new record" page ? Once added, I need the "Link" field to be visible.
Thank you

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1638
Joined: 2018-04-01 10:12

Re: hide field on "add new record" page

Post by pbottcher » 2020-09-25 21:42

Hi,

you can check if the detail view contains a SelectedID. If not, hide your field.

Check for

if ($j('input[name="SelectedID"]').val()=="") { then HIDE YOUR FIELD }
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

jinxy45
Posts: 12
Joined: 2014-09-09 11:20

Re: hide field on "add new record" page

Post by jinxy45 » 2020-09-26 07:44

pböttcher thank you. What would be the syntax for "HIDE YOUR FIELD" please ? Assuming the fieldname is "Link"

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1638
Joined: 2018-04-01 10:12

Re: hide field on "add new record" page

Post by pbottcher » 2020-09-26 08:15

try

$j('#Link').hide()
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

jinxy45
Posts: 12
Joined: 2014-09-09 11:20

Re: hide field on "add new record" page

Post by jinxy45 » 2020-09-26 14:08

thank you again, your help is much appreciated but I couldn't get it to work. I did find that in template_DV there were 5 rows allocated to "Link" and I only need one so I shrank it to only one. This moves the "Notes" field back up so hopefully will reduce input errors.

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1638
Joined: 2018-04-01 10:12

Re: hide field on "add new record" page

Post by pbottcher » 2020-09-26 16:27

Hi,

where did you put the code? Maybe you can post what you did?
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

jinxy45
Posts: 12
Joined: 2014-09-09 11:20

Re: hide field on "add new record" page

Post by jinxy45 » 2020-09-27 08:14

Hi pböttcher, I'm using Appgini v.5.84, and have used Appgini for 10 years. I am not a coder/programmer, (BASIC was about the height of my achievements) but I get by with reading FAQ's, forums and Google. My business has been hit hard by covid-19 and it's not viable to spend a lot of time on my database appplication. Your suggestion of checking for "SelectedID" was very welcome and I inserted the line at various place in the /templates/***_template_DV.html but the result was either a line of text, or no difference. I had hoped there would be a simple solution but it appears not. Thanks again for your help.

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1638
Joined: 2018-04-01 10:12

Re: hide field on "add new record" page

Post by pbottcher » 2020-09-27 10:24

Hi,

thanks for the insides. As it is not possible to know what level of knowledge is available to the person asking a question in the forum it is very hard to tell how much help is needed. So it would be beneficial to understand that in order to provide (more) help. Also not providing detailed information about the settings makes it very hard to provide a bullet-proof solution.

In your case you need to place the code in the hooks folder into the file called TABLENAME-dv.js (if it does not exist, create it) where TABLENAME is the table containing your field "Link".

Try

Code: Select all

$j(function() {
if ($j('input[name="SelectedID"]').val()=="") { $j('#Link').hide() }
})
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

jinxy45
Posts: 12
Joined: 2014-09-09 11:20

Re: hide field on "add new record" page

Post by jinxy45 » 2020-09-27 14:06

It works !!!! Thank you so much, your patient help and understanding is very much appreciated. You've made my life a little easier. Best regards, Norman :D :D

Post Reply