gpt4 book ai didi

javascript - 如何使用 Javascript 从 APEX_ITEM 设置页面元素的值

转载 作者:行者123 更新时间:2023-11-30 13:13:19 26 4
gpt4 key购买 nike

我正在 Oracle Apex 中编写一些代码,我没有开发背景,所以请原谅我的错误代码。我正在动态生成一个表单,并且我想在用户更改特定表单元素的值时设置一个隐藏的页面项。这是我正在使用的代码:

    select APEX_ITEM.HIDDEN(2,base_data_seq_nbr)||APEX_ITEM.HIDDEN(6,case when substr(description,0,1)= chr(49838) then substr(description,-(length(description)-1)) else description end)||APEX_ITEM.HIDDEN(7,case when substr(description,0,1)= chr(49838) then 1 else 0 end)||APEX_ITEM.HIDDEN(9,
data_select(replace(replace(trim(substr(field_name,-(length(field_name)-instr(field_name,',',1)))),'BSBR',''),'C','L'), substr(field_name,0,instr(field_name,',',1)-1), :P721_XCASE,:P721_XRETSTAT,:P721_XID,:P721_XCUSNUM,:P721_DB_ID))||case when substr(description,0,1)= chr(49838)
then '<img src="/i/themes/theme_2/images/required.gif" alt="Value Required" alt="Value Required" />'
else null
end as req_ind,
case when substr(description,0,1)= chr(49838)
then substr(description,-(length(description)-1))
else description
end as description,
APEX_ITEM.DATE_POPUP(1,rownum,
to_date(data_select(replace(replace(trim(substr(field_name,-(length(field_name)-instr(field_name,',',1)))),'BSBR',''),'C','L'), substr(field_name,0,instr(field_name,',',1)-1), :P721_XCASE,:P721_XRETSTAT,:P721_XID,:P721_XCUSNUM,:P721_DB_ID),'MM/DD/YYYY'),'MM/DD/YYYY',10,10,'onkeyup="javascript:FormatDate(this);"' ||case when instr(substr(field_name,1,4),'DOB,',1)>0 then ' onchange="javascript:$s(''P721_DOB_RBD'',this);"' end,'datepicker_'||rownum)
end
end as field_format
from bcvsown.bcvs_base_data
inner join v_lookup v
on v.value_seq = stmt_type
left join (select * from apex_collections where collection_name = 'ERR_COLLECTION') ac
on base_data_seq_nbr=ac.n001
where caseno = :P721_XCASE
and v.value_cd = case when :P721_XDE_SEQ > 1 then decode(:P721_XIS_BSRS,'true','BSRS','BET') else v.value_cd end
and db_id = :P721_DB_ID
and v.type_cd = 'STMT_TYPE'
order by base_data_seq_nbr

页面按预期呈现,没有错误,页面源代码显示仅应用于我瞄准的元素。但是当我更改元素时,它似乎没有设置隐藏页面项的值(P721_DOB_RBD)

最佳答案

无意冒犯,该标记非常糟糕。花时间正确格式化和缩进您的代码!

至于你的问题,this is the Oracle apex javascript apis reference for $s

$s(pNd, pValue, pDisplayValue, pSuppressChangeEvent)

Given a DOM node or string ID (pNd), this function sets theApplication Express item value taking into account the item type. ThepDisplayValue is optional. If used for a page item of type "Popup LOV"where the attribute "Input Field" = "Not Enterable, Show Display Valueand Store Return Value", it is used to set the "Input Field". Thevalue of pValue is stored in the hidden return field. ThepSuppressChangeEvent parameter is optional. Passing either FALSE ornot passing this parameter value results in a change event firing forthe item being set. Pass TRUE to prevent the change event from firingfor the item being set.

Parameters

pNd (DOM Node | string ID)
pValue (String | Array)
pDisplayValue(String)
pSuppressChangeEvent(Boolean)

传递 this 是行不通的。当你想传递一个值时,这将传递对象。由于您正在创建一个 APEX_ITEM.DATE_POPUP,它将生成一个 input 项,因此您需要在 value code>change 事件发生。您可以使用 $v ( ref )

$v(pNd)

Given a DOM node or string ID (pNd), this function returns the valueof an Application Express item in the same format as it would beposted.

Parameters

pNd (DOM Node | string ID)

那么,试试这个:

(onchange="javascript:$s(''P721_DOB_RBD'',$v(this));")

关于javascript - 如何使用 Javascript 从 APEX_ITEM 设置页面元素的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13052916/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com