show/hide a field

drashrafsabry

Well-known member
question
when it hides the items
do it leave empty space?

meaning if i have 10 items under each other and i hide number 2 , 3 , 4, will the rest down advance up or will there be empty space?
 

drashrafsabry

Well-known member
i am sorry can i have a small demo as i am not a programmer at all

for e.g if i have a dropdown with values

i want if i choose for e.g value from the dropdown valueA certain fields appear and certain disappear .. How can that be done plz

for e.g i have values in the dropdown ( LABS , IMAGES , ULTRASOUND)

and field names like Lab1 , lab2 , lab3 , image1 , image2 , image3 , ultrasound1 , ultrasound2 , ultrasound3
if i choose labs i want the lab1,2,3 show and the rest dissappear
 

FRW

Well-known member
The demos are in the topic above (page1).

You have to:
1. wrote a function in /include/custom_function.js
2. Worte "onchange:dadabik_name_of_this_function" in the field, which is a single_select (for dropdown) at general settings - JS event functions
3. if you want to hide the fields normally and only be shown when selected: wrote a custom.css
 

Rox

New member
I rewrite my custom css code in order to remove the field that I don't want to be displayed.
Now in my custom code I use the following code:

span[id="your_id_field"] {display:none;}
label[for="your_id_field"] {display:none;}

Best
 

drashrafsabry

Well-known member
1- Ok created the CSS file with the following for all my fields

input[name="Uterus_Position"] {display:none;}
label[for="Uterus_Position"] {display:none;}
span[id="Uterus_Position"] {display:none; max-height:0px;}

2- Have a drop down list with values and when a value is choosen it triggers the custom_functions.js to show what i want
$('label[for="Uterus_Position"]').css('display', 'block');
$('input[name="Uterus_Position"]').css('display', 'block');
$('span[id="Uterus_Position"]').css('display', 'block');

Till now it works fine
My comments
a- White space is there when fields are hidden , i want to cancel all white space
b- when i save the record and open it again , all fields are hidden unless i change the dropdown list again , how can i make an onloadpage value for details/edit page for the record
 

Rox

New member
Actually I don't use anymore the style "max-height:0px;" and in my form there's no white space (I use safari & chrome on Mac High Sierra).
In my form I want that some field are always hide till a specified value is inserted in another field... So for my needs, everything works now.

For you, I think that you can try to use the new custom startup function (introduced by Monterosso 9.1). I would try to create a startup function that search the target value and applies the CSS rules in some conditions.

Best
 

drashrafsabry

Well-known member
I did remove the max-height

input[name="Uterus_Position"] {display:none;}
label[for="Uterus_Position"] {display:none;}
span[id="Uterus_Position"] {display:none;}

and i use chrome / safari

still lots of white space and now even corrupted layout
 
Top