Page 1 of 1

hide field on "add new record" page

Posted: 2020-09-25 16:09
by jinxy45
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

Re: hide field on "add new record" page

Posted: 2020-09-25 21:42
by pbottcher
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 }

Re: hide field on "add new record" page

Posted: 2020-09-26 07:44
by jinxy45
pböttcher thank you. What would be the syntax for "HIDE YOUR FIELD" please ? Assuming the fieldname is "Link"

Re: hide field on "add new record" page

Posted: 2020-09-26 08:15
by pbottcher
try

$j('#Link').hide()

Re: hide field on "add new record" page

Posted: 2020-09-26 14:08
by jinxy45
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.

Re: hide field on "add new record" page

Posted: 2020-09-26 16:27
by pbottcher
Hi,

where did you put the code? Maybe you can post what you did?

Re: hide field on "add new record" page

Posted: 2020-09-27 08:14
by jinxy45
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.

Re: hide field on "add new record" page

Posted: 2020-09-27 10:24
by pbottcher
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() }
})

Re: hide field on "add new record" page

Posted: 2020-09-27 14:06
by jinxy45
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