django-location-field icon indicating copy to clipboard operation
django-location-field copied to clipboard

Can I hide the input (id_location) box but retain the others?

Open tim-blackmore opened this issue 4 years ago • 4 comments

Hopefully a simple one, but I am struggling to hide one of the input boxes. Does anyone have any advice?

image

tim-blackmore avatar Nov 07 '20 11:11 tim-blackmore

Not the cleanest, but assuming your field is called location, add to your template:

<script>
    $( document ).ready(function() {
        document.getElementById('id_location').style.display = "none";
    });
</script>

iragm avatar Dec 27 '20 00:12 iragm

Thank you!

tim-blackmore avatar Jan 19 '21 09:01 tim-blackmore

Thanks @iragm . But when I use JavaScript or CSS to hide id_location, even the map is not visible. @tim-blackmore

aniruddha-ca avatar Feb 26 '21 05:02 aniruddha-ca

Make sure you are not hiding the whole div -- div_id_location_coordinates will hide everything. The above code works for me. Post code from your model and template.

iragm avatar Feb 26 '21 11:02 iragm

or add something like this in your css file

form input#id_location {display:none;}

replace "id_location" with the input id off course

want to hide the label text then add something lik this to your css file

form label[for="id_location"] {display:none;}

michaelhjulskov avatar Mar 02 '23 12:03 michaelhjulskov