0.0.67 add showSearchList
This commit is contained in:
@@ -157,6 +157,8 @@ function searchTown(el){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function selectItemAddrPoint(id, name, ctrl_name,){
|
function selectItemAddrPoint(id, name, ctrl_name,){
|
||||||
let input_list = document.getElementsByName(ctrl_name + '_list')[0];
|
let input_list = document.getElementsByName(ctrl_name + '_list')[0];
|
||||||
let tap_txt_cont = document.querySelector("#id_" + ctrl_name);
|
let tap_txt_cont = document.querySelector("#id_" + ctrl_name);
|
||||||
@@ -182,12 +184,24 @@ function insertSearchList(data, ctrl_name) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
function showSearchList() {
|
|
||||||
let input_list = document.getElementsByClassName('input_list');
|
|
||||||
if(input_list.classList.contains('show')){
|
function showSearchList(el) {
|
||||||
input_list.classList.add("show");
|
if(el.classList.contains('from_address_point_txt')){
|
||||||
|
let input_list = document.querySelectorAll('.input_list')
|
||||||
|
let value = input_list[0].classList.contains('show')
|
||||||
|
if(value === false && input_list[0].childElementCount > 0){
|
||||||
|
input_list[0].classList.add("show");
|
||||||
|
}
|
||||||
|
}else if (el.classList.contains('to_address_point_txt')) {
|
||||||
|
let input_list = document.querySelectorAll('.input_list')
|
||||||
|
let value = input_list[1].classList.contains('show')
|
||||||
|
if(value === false && input_list[1].childElementCount > 0){
|
||||||
|
input_list[1].classList.add("show");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function onblurInputField(event,el){
|
function onblurInputField(event,el){
|
||||||
|
|||||||
@@ -68,12 +68,13 @@
|
|||||||
<input type="number" name="from_address_point" id="id_from_address_point" hidden />
|
<input type="number" name="from_address_point" id="id_from_address_point" hidden />
|
||||||
<input
|
<input
|
||||||
oninput="searchTown(this)"
|
oninput="searchTown(this)"
|
||||||
onclick="searchTown(this)"
|
onclick="showSearchList(this)"
|
||||||
onblur="setTimeout(()=>onblurInputField(event, this), 100)"
|
onblur="setTimeout(()=>onblurInputField(event, this), 100)"
|
||||||
onFocus="this.select()"
|
onFocus="this.select()"
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
type="text"
|
type="text"
|
||||||
name="from_address_point_txt"
|
name="from_address_point_txt"
|
||||||
|
class="from_address_point_txt"
|
||||||
{% if form.fields.from_address_point.required %} required{% endif %}
|
{% if form.fields.from_address_point.required %} required{% endif %}
|
||||||
id="id_from_address_point_txt"
|
id="id_from_address_point_txt"
|
||||||
{% if form.initial.from_address_point_txt %}value="{{ form.initial.from_address_point_txt }}"{% endif %}
|
{% if form.initial.from_address_point_txt %}value="{{ form.initial.from_address_point_txt }}"{% endif %}
|
||||||
@@ -93,7 +94,7 @@
|
|||||||
<input type="number" name="to_address_point" id="id_to_address_point" hidden />
|
<input type="number" name="to_address_point" id="id_to_address_point" hidden />
|
||||||
<input
|
<input
|
||||||
oninput="searchTown(this)"
|
oninput="searchTown(this)"
|
||||||
onclick="searchTown(this)"
|
onclick="showSearchList(this)"
|
||||||
onblur="setTimeout(()=>onblurInputField(event, this), 100)"
|
onblur="setTimeout(()=>onblurInputField(event, this), 100)"
|
||||||
onFocus="this.select()"
|
onFocus="this.select()"
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
@@ -101,6 +102,7 @@
|
|||||||
name="to_address_point_txt"
|
name="to_address_point_txt"
|
||||||
{% if form.fields.to_address_point.required %} required{% endif %}
|
{% if form.fields.to_address_point.required %} required{% endif %}
|
||||||
id="id_to_address_point_txt"
|
id="id_to_address_point_txt"
|
||||||
|
class="to_address_point_txt"
|
||||||
{% if form.initial.to_address_point_txt %}value="{{ form.initial.to_address_point_txt}}"{% endif %}
|
{% if form.initial.to_address_point_txt %}value="{{ form.initial.to_address_point_txt}}"{% endif %}
|
||||||
|
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user