I have below two javascripts
on a page HTML Header
in my oracle apex application.
<script type="text/javascript">
function createEventListeners3(pThis)
{
var mainRow = "f04_"+pThis.id.substr(pThis.id.indexOf('_')+1);
$("#" + mainRow).change(function(){
var that = this;
var vRow = "f06_"+pThis.id.substr(pThis.id.indexOf('_')+1);
$.post("wwv_flow.show",
{p_request : "APPLICATION_PROCESS=GET_AMOUNT",
p_flow_id : $v("pFlowId"),
p_flow_step_id : $v("pFlowStepId"),
p_instance : $v("pInstance"),
x01 : $(this).val()
},
function(data){
if ($("#" + vRow).val() == ''){
$("#" + vRow).val(data);
}
},
"text"
);
});
}
</script>
and i'm calling above javascript
from autocomplete select event
in here.
<script type="text/javascript">
function createEventListeners()
{
$(function(){
/* Set autocomplete */
$('input[name="f04"]').autocomplete({
source:function(req,res){
/* Parameters for jQuery ajax */
var opt={
url:"wwv_flow.show",
dataType:"json",
traditional:true,
cache:false,
type:"POST",
data:{
p_flow_id:$v("pFlowId"),
p_flow_step_id:$v("pFlowStepId"),
p_instance:$v("pInstance"),
p_request:"APPLICATION_PROCESS=GET_DESCRIPTION",
x01:req.term
},
success:function(jsonData){
res(
$.map(jsonData.row,function(jsonRow){
return{
label:jsonRow.RET,
value:jsonRow.DIS
};
})
);
}
};
/* Call Ajax to get list */
$.ajax(opt);
},
focus:function(event,ui){
/* Prevent value change when list get focus */
// return false;
event.preventDefault();
},
select: function (event, ui) {
createEventListeners3(this.id);
}
});
});
return;
}
</script>
but i'm getting below error.
Uncaught TypeError: Cannot call method 'indexOf' of undefined
How could i solve this ?
You can already passing id not the object to function createEventListeners3
. Pass the object using this
instead of this.id
Change
createEventListeners3(this.id);
To
createEventListeners3(this);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.