Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/system/survey/js/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -1340,6 +1340,11 @@ return {
}}),true);
}}));
},
searchInstance: function(ctxt){
var name = opendatakit.getCurrentInstanceId();
console.log(name);
},

reset: function(ctxt,sameForm) {
var that = this;
ctxt.log('I','controller.reset');
Expand Down
29 changes: 28 additions & 1 deletion app/system/survey/js/prompts.js
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,7 @@ promptTypes.instances = promptTypes.base.extend({
valid: true,
_cachedEvent: null,
_protoDisplay: {
search_instance: 'search_instance',
instances_survey_form_identification: 'survey_form_identification',
new_button_label: 'instances_survey_create_button_label',
instances_last_save_date_label: 'instances_last_save_date_label',
Expand All @@ -584,7 +585,8 @@ promptTypes.instances = promptTypes.base.extend({
events: {
"click .openInstance": "openInstance",
"click .deleteInstance": "confirmDeleteInstance",
"click .createInstance": "createInstance"
"click .createInstance": "createInstance",
"click .searchInstance": "searchInstance"
},
configureRenderContext: function(ctxt) {
var that = this;
Expand Down Expand Up @@ -710,8 +712,33 @@ promptTypes.instances = promptTypes.base.extend({
ctxt.failure(m);
}}));
}
},
searchInstance: function (evt) {
var that= this
that._cachedEvent = evt;
const search = document.getElementById('searchBox');
// if (that._cachedEvent === null || that._cachedEvent === undefined) {
// return;
// }
var instanceToSearch = $(evt.currentTarget).attr('display_value');

console.log(search)
if ( instanceToSearch !== null && instanceToSearch !== undefined ) {
var ctxt = that.controller.newContext(that._cachedEvent, that.type + ".searchInstance");
that.controller.enqueueTriggeringContext($.extend({},ctxt,{success:function() {
odkCommon.log('D',"prompts." + that.type + ".searchInstance", "px: " + that.promptIdx);
that.controller.searchInstance(ctxt, instanceToSearch)
}}))
// search.addEventListener('keyup',(e)=>{
// console.log(ctxt);
// })

}
}


});

promptTypes.contents = promptTypes.base.extend({
type:"contents",
hideInContents: true,
Expand Down
11 changes: 10 additions & 1 deletion app/system/survey/templates/instances.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,16 @@
</fieldset>
<hr>
</div>


<div id="searchBox" >
<form id="form" >
<input id="search" type="text" name="query" size="15" placeholder="Enter Instances..." />{{localizeText display.search_instance}}
<button type="button" id="{{instance_id}}" display_value="{{display_field}}" class="odk searchInstance btn btn-default" >
<span class="glyphicon glyphicon-search" style="font-size:20px;">
</button>
</form>
</div>

{{{localizeText display.instances_previously_created_instances_label}}}
<hr>
<div class="instanceList">
Expand Down