Ron
Posts: 26
|
| Posted: 02/02/2006, 7:26 PM |
|
I'm trying to update a hidden control with the results of a dialog. I've tried both of these methods:
Method 1
function IsInternal()
{
var result;
result = window.confirm('Is this reply for internal eyes only?');
var tblCaseResponse_hidInternal = new Object();
if (result==true)
{
tblCaseResponse_hidInternal.Value = 1
}
else
{
tblCaseResponse_hidInternal.Value = 0
}
}
Method 2
function IsInternal()
{
var result;
result = window.confirm('Is this reply for internal eyes only?');
if (result==true)
{
document.tblCaseResponse.hidInternal.Value = 1
}
else
{
document.tblCaseResponse.hidInternal.Value = 0
}
}
I believe the dialog is working correctly, but I must have the syntax wrong for updating the control value. I'm using CCS 3.0.2.2
|
 |
 |
dragoon
Posts: 173
|
| Posted: 02/02/2006, 7:56 PM |
|
second method is the right one with a small correction:
.value and not .Value
also consider the use of ternary operator:
document.tblCaseResponse.hidInternal.value = result ? 1 : 0
|
 |
 |
Ron
Posts: 26
|
| Posted: 02/04/2006, 7:49 AM |
|
Thanks this line works now:
function IsInternal() {
document.tblCaseReply.hidInternal.value=1;
}
But this doesn't, why?
function IsInternal() {
var mytest=1;
if (mytest = 1)
{
document.tblCaseReply.hidInternal.value=1;
}
else
document.tblCaseReply.hidInternal.value=0;
}
}
|
 |
 |
Ron
Posts: 26
|
| Posted: 02/04/2006, 7:58 AM |
|
This is what I'm really trying to accomplish:
<script language="JavaScript" type="text/javascript">
IE4 = (document.all);
function newConfirm(title,msg,icon,defbut,mods) {
if (IE4) {
icon = (icon==0) ? 0 : 2;
defbut = (defbut==0) ? 0 : 1;
retVal = makeMsgBox(title,msg,icon,4,defbut,mods);
retVal = (retVal==6);
}
else {
retVal = confirm(msg);
}
return retVal;
}
function IsInternal() {
var result;
var mytest=1;
if (mytest > 1)
{
result = newConfirm("Internal Use?","Is this reply for support staff eyes only?",1,1,0);
}
else
result = 0;
}
document.tblCaseReply.hidInternal.value=result;
}
</script>
<script language="VBScript">
<!--
Function makeMsgBox(tit,mess,icons,buts,defs,mods)
butVal = buts + (icons*16) + (defs*256) + (mods*4096)
makeMsgBox = MsgBox(mess,butVal,tit)
End Function
-->
</script>
|
 |
 |
dragoon
Posts: 173
|
| Posted: 02/04/2006, 8:05 AM |
|
Quote Ron:
Thanks this line works now:
function IsInternal() {
document.tblCaseReply.hidInternal.value=1;
}
But this doesn't, why?
function IsInternal() {
var mytest=1;
if (mytest = 1) // that's why ...
{
document.tblCaseReply.hidInternal.value=1;
}
else
document.tblCaseReply.hidInternal.value=0;
}
}
|
 |
 |
dragoon
Posts: 173
|
| Posted: 02/04/2006, 8:06 AM |
|
+ missing { right after else ...
|
 |
 |
Ron
Posts: 26
|
| Posted: 02/04/2006, 9:44 AM |
|
That fixed it! Thanks dragoon for the second pair of eyes.
|
 |
 |
|