Hello,
I'm having trouble figuring out the proper syntax for e._setElement in a ajax callback. I'm trying to mimic the code template provided in the same callback function, but
e._setElement doesn't work for me.
Here's the function, with my code in bold, the sample code in normal font:
function patientLogin as c (e as p)
loginID=e.dataSubmitted.LoginID
password=e.dataSubmitted.password
dim cnw as sql::Connection
cnw.open("::name::wms")
sql=<<%txt%
SELECT firstTimeLogin,account FROM patient WHERE loginID='%txt%+loginID+<<%txt%
' AND password=md5('%txt%+password+"')"
cnw.execute(sql)
rs=cnw.ResultSet
if rs.nextRow() then
firstTimeLogin=rs.data("firstTimeLogin")
e._set.ACCOUNT.value=rs.data("account")
' the next line does not set the innerHTML of the DIV with an id of PATIENTLOG.V.R1.CONTAINER_1
' e._setElement.PATIENTLOG.V.R1.CONTAINER_1.value="<p>here i am</p>"
' and neither does this work:
' e._setElement.CONTAINER_1.value="<p>here i am</p>"
else
e._set.errMessage.value="Invalid Login or Password!"
e._set.errMessage.style="color: red;"
'e.javascript="alert('Login or password incorrect!');"
end if
delete rs
'Note:
'e._set.lastname.value = "Smith" gets converted to this Javascript code: '{dialog.object}.setValue('LASTNAME','' + 'Smith',true);' and this code is automatically added to the Ajax response.
'Note:
'In addition to 'e._set', you can set properties of the 'e._setElement' object.
'Examples:
'e._setElement.DIV1.value = "Some text" --- sets the innerHTML of DIV with the id of 'DIV1'
'e._setElement.SPN2.style.color = "Red" ---- sets style properties of a SPAN with id of 'SPN2'
'example code:
'Return a Javascript command
'patientLogin = "alert('You submitted a value of: " + js_escape(e._currentRowDataNew.lastname) + "');"
' This javascript works, but it doesn't use any e._set or e._setElement to work
patientLogin=<<%txt%
var btn1=document.getElementById('PATIENTLOG.V.R1.RESULTS_BTN');
btn1.onclick=function()
{
alert('i wuz pressed');
}
%txt%
' The code on the next line does not work
'e._setElement.RESULTS_BTN.onclick="function() {alert('i wuz pressed');}"
end function
What is it about e._setElement that I'm not using properly?
Thanks.
- Peter
I'm having trouble figuring out the proper syntax for e._setElement in a ajax callback. I'm trying to mimic the code template provided in the same callback function, but
e._setElement doesn't work for me.
Here's the function, with my code in bold, the sample code in normal font:
function patientLogin as c (e as p)
loginID=e.dataSubmitted.LoginID
password=e.dataSubmitted.password
dim cnw as sql::Connection
cnw.open("::name::wms")
sql=<<%txt%
SELECT firstTimeLogin,account FROM patient WHERE loginID='%txt%+loginID+<<%txt%
' AND password=md5('%txt%+password+"')"
cnw.execute(sql)
rs=cnw.ResultSet
if rs.nextRow() then
firstTimeLogin=rs.data("firstTimeLogin")
e._set.ACCOUNT.value=rs.data("account")
' the next line does not set the innerHTML of the DIV with an id of PATIENTLOG.V.R1.CONTAINER_1
' e._setElement.PATIENTLOG.V.R1.CONTAINER_1.value="<p>here i am</p>"
' and neither does this work:
' e._setElement.CONTAINER_1.value="<p>here i am</p>"
else
e._set.errMessage.value="Invalid Login or Password!"
e._set.errMessage.style="color: red;"
'e.javascript="alert('Login or password incorrect!');"
end if
delete rs
'Note:
'e._set.lastname.value = "Smith" gets converted to this Javascript code: '{dialog.object}.setValue('LASTNAME','' + 'Smith',true);' and this code is automatically added to the Ajax response.
'Note:
'In addition to 'e._set', you can set properties of the 'e._setElement' object.
'Examples:
'e._setElement.DIV1.value = "Some text" --- sets the innerHTML of DIV with the id of 'DIV1'
'e._setElement.SPN2.style.color = "Red" ---- sets style properties of a SPAN with id of 'SPN2'
'example code:
'Return a Javascript command
'patientLogin = "alert('You submitted a value of: " + js_escape(e._currentRowDataNew.lastname) + "');"
' This javascript works, but it doesn't use any e._set or e._setElement to work
patientLogin=<<%txt%
var btn1=document.getElementById('PATIENTLOG.V.R1.RESULTS_BTN');
btn1.onclick=function()
{
alert('i wuz pressed');
}
%txt%
' The code on the next line does not work
'e._setElement.RESULTS_BTN.onclick="function() {alert('i wuz pressed');}"
end function
What is it about e._setElement that I'm not using properly?
Thanks.
- Peter
Comment