/    Sign up×
Community /Pin to ProfileBookmark

unchecking a check box?

From a pop up window, if submitted, I want to uncheck a box on the opener page. I tried

[code=php]window.opener.document.form1.shipto_as_ultdes.checked == false;
alert(window.opener.document.form1.shipto_as_ultdes.checked);
[/code]

and

[code=php]window.opener.document.form1.shipto_as_ultdes.checked.value == false;
alert(window.opener.document.form1.shipto_as_ultdes.checked);
[/code]

neither works (true comes up in the alert and the box stays checked)

to post a comment
JavaScript

6 Comments(s)

Copy linkTweet thisAlerts:
@PittimannDec 30.2003 — Hi!

Please try it with just one '=' instead of two...

Cheers - Pit
Copy linkTweet thisAlerts:
@fredmvDec 30.2003 — [i]Originally posted by furious70 [/i]

[B](true comes up in the alert and the box stays checked) [/B][/QUOTE]
That's because you're using the comparison operator as opposed to the assignment operator. It's telling you whether or not the checkbox is checked instead of actually changing whether it is checked or not.
Copy linkTweet thisAlerts:
@oleragDec 30.2003 — Pittiman is much faster..

Here's some code without the equivalence operator and

calling the JS function contained in the "parent"...

[code=php]
<html>
<head>
<script type="text/javascript">
var newWindow;

function unCheckIt() {
document.forms[0].cb1.checked = false;
}

function checkIt() {
document.forms[0].cb1.checked = true;
}

function openPopup() {
var windowAtt = "height=300,width=300,left=100,top=100";
var day = new Date();
var id = day.getTime();
newWindow = window.open('', id, windowAtt);
newWindow.document.open();
newWindow.document.write("<html>");
newWindow.document.write("<body>");
newWindow.document.write('Child Window Name: ' + id);
newWindow.document.write("<form>");
newWindow.document.write("<input type="button" value="Uncheck It" onClick="window.opener.unCheckIt()">");
newWindow.document.write("<input type="button" value="Check It" onClick="window.opener.checkIt()">");
newWindow.document.write("</form>");
newWindow.document.write("</form>");
newWindow.document.write("</body>");
newWindow.document.write("</html>");
newWindow.document.close();
}
</script>
</head>
<body>
Parent Window.
<center>
<form>
<input type="checkbox" name="cb1" value="Y">My Checkbox
<p>
<input type="button" name="openBtn" value="Open Child" onClick="openPopup()">
<input type="button" name="uncheckBtn" value="UnCheck It" onClick="unCheckIt()">
<input type="button" name="checkBtn" value="Check It" onClick="checkIt()">
</form>
</center>
</body>
</html>
[/code]
Copy linkTweet thisAlerts:
@furious70authorDec 30.2003 — oh good grief. I stared at this forever not seeing what was going on. Funny that last week I corrected someone else's use of == where = belonged ?
Copy linkTweet thisAlerts:
@oleragDec 30.2003 — Yes, like that never happens to me.

This is not a good place to ask it but....

When attempting to communicate with a parent's objects,

is it OK to directly access those objects or should the

communication be performed with functions that reside in

the parent??? Or, is this a preferential thing?
Copy linkTweet thisAlerts:
@furious70authorDec 30.2003 — while putting that code in the parent JS may work well for JS, the popup window has several DB queries, and a scrollable list of values interface for returned results and such all written in ColdFusion.
×

Success!

Help @furious70 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.29,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...