-
Notifications
You must be signed in to change notification settings - Fork 4
Hide textbox for unlisted organisation in edit profile form if an organisation is selected from given list #623
Hide textbox for unlisted organisation in edit profile form if an organisation is selected from given list #623
Conversation
@tonythomas01 @tapasweni-pathak Please review. |
</div> | ||
</div> | ||
<script type="text/javascript" src="{% static 'vms/js/hide_organization.js' %}"></script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this a new file you are introducing ? Please commit the one to app/static/ or media/ ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No @tonythomas01 Its already there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool then.
<div class="col-md-8"> | ||
<input class="form-control" type="text" placeholder="{% blocktrans %}Organization{% endblocktrans %}" name="unlisted_organization" value="{% if form.unlisted_organization.value %}{{ form.unlisted_organization.value }}{% endif %}"> | ||
<div id="div_id_unlisted_organization" class="col-md-8"> | ||
<input id="id_unlisted_organization" class="form-control" type="text" placeholder="{% blocktrans %}Organization{% endblocktrans %}" name="unlisted_organization" value="{% if form.unlisted_organization.value %}{{ form.unlisted_organization.value }}{% endif %}"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ideally, id should be unique - and if there is a need for you to do this, there might be something wrong with the original design - and we might want to change it ?
https://www.w3.org/TR/html4/struct/global.html 7.5.2
div_id_unlisted_organization
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tonythomas01 input id is not needed. Thus removed them. Please review.
<label class="col-md-2 control-label">{% trans "If your organization is not listed, please provide it here:" %}</label> | ||
<div class="col-md-8"> | ||
<div id="div_id_unlisted_organization" class="col-md-8"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oopsie. same id
used twice ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tonythomas01 If I change the id then I will have to rewrite the hide_organization function again for that which wil be redundant.
Can't we keep the same id as they are in different templates and both have exactly same function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
even though, I am wondering why you have to use this id on these two fields. When you hide the parent element, the child too gets hidden right ?
Bonus, this hide and seek in js can be replaced with http://api.jquery.com/toggle/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tonythomas01 That is not the parent infact they reflect the same div that's why they have the same id. There is an if-else statement in between.
Description
If the user has selected from the listed organisations , then the unlisted organisation textbox doesn't appear.
Fixes #622
Type of Change:
Code/Quality Assurance Only
How Has This Been Tested?
Checklist
Code/Quality Assurance Only