CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Update hidden control with confirmation return value

Print topic Send  topic

Author Message
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
View profile  Send private message
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
View profile  Send private message
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;
}
}
View profile  Send private message
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>
View profile  Send private message
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;
}
}
View profile  Send private message
dragoon


Posts: 173
Posted: 02/04/2006, 8:06 AM

+ missing { right after else ...
View profile  Send private message
Ron


Posts: 26
Posted: 02/04/2006, 9:44 AM

That fixed it! Thanks dragoon for the second pair of eyes.
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.