 |
 |
Trying it Apple style... PLEASE HELP!!!
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: May 2001
Location: SouthBank, Victoria, Australia
Status:
Offline
|
|
PLEASE READ CAREFULLY (CODE ONLY WORKS ON IE5+/NS6+)
I'm currently trying to do an Info popup window just like the Apple cmnd+i window for those Apple guys here, but through JS/HTML FORMS... anyways the principle is the same.
I have a parent window which popups this window and when I check the locked checkbox on the popup window I wish to make certain form elements in the parent window disabled... much like Apple Info Popup
anyways the pseudo is :
/* this is popup */
function updateInfo(theForm, locked){
if(window.opener != null){
//alert('I have parent')
if(!window.opener.closed){
/* write object attributes accross: seeing we have the same name just assign */
window.opener.document.pauditForm.pATT_label.value = theForm.pATT_label.value;
window.opener.document.pauditForm.ATT_colour.value = theForm.ATT_colour.value;
window.opener.document.pauditForm.pATT_version.val ue = theForm.pATT_version.value;
window.opener.document.pauditForm.pATT_comments.va lue = theForm.pATT_comments.value;
window.opener.document.pauditForm.pATT_locked.valu e = theForm.pATT_locked.value;
window.opener.document.pauditForm.pATT_publishfrom date.value = theForm.pATT_publishfromdate.value;
window.opener.document.pauditForm.pATT_publishtoda te.value = theForm.pATT_publishtodate.value;
window.opener.document.pauditForm.pATT_active.valu e = theForm.pATT_active.value;
window.opener.document.pauditForm.pATT_archive.val ue = theForm.pATT_archive.value;
window.opener.document.pauditForm.pATT_approve.val ue = theForm.pATT_approve.value;
window.opener.document.pauditForm.pATT_template.va lue = theForm.pATT_template.value;
if(locked){
window.opener.lockAtt(window.opener.document.paudi tForm, locked);
}
}
}
}
/* this is parent */
function lockAtt(theForm, locked){
/* currently not changing locked to unlocked */
/*
var i;
for(i=0; i<theForm.elements.length; i++){
var me = theForm.elements[i];
if((me.name.search('pATT_') == -1) && me.name != 'pworkflowAlert' && me.name != 'pinfo' && me.name != 'pcancel'){
me.disabled = locked;
}
}
*/
}
Now the BIG PROBLEM IS...
disabling the form elements is OK, but once I have disabled the form elements and then popup the info window again reseting the Locked checkbox so that is unchecked and the parent form elements are still disabled... this is a problem... is it because child objects can change parent attributes once changed?
And I know that I'm passing in the correct params to lockAtt() when the lock checkbox is check in the popup, it passes 1:locked, when it is uncheck it passes 0:locked and the form stayes the same...
Any reasons why the above can't be changed? as the code below works
function lockAtt(theForm, locked){
theForm.pLabel.disabled = locked;
theForm.pVersion.disabled = locked;
theForm.pComments.disabled = locked;
}
but the code just above is within a window that has a form in it and when the locked checkbox is checked it locks the three form elements otherwise undisables them...
cheers
|
|
"We are what we repeatedly do. Excellence then, is not an act, but a habit." Aristotle
|
| |
|
|
|
 |
|
 |
|
Forum Regular
Join Date: Feb 2002
Location: San Francisco
Status:
Offline
|
|
do you have a demo page.. might be easier to see whats happening.
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: May 2001
Location: SouthBank, Victoria, Australia
Status:
Offline
|
|
dude, its back end administration...
I'm sure you can figure out from the code what I'm trying to do...
the child window has a form. the parent window has a form... some elements of the parent are identical to that of the child. the only difference is that the child sets these parameters and then writes them to the parent attributes.
now if say the locked attribute is checked (checkbox)... that is within the child window, it should disable certain form elements in the parent window... WHICH IT DOES... the problem is when I uncheck the locked attribute(checkbox) it should make it that the parent form attributes that I disabled should now be editable.... THIS IS WHAT IT DOESN'T DO....
the code being function lockAtt(theForm, locked) where the theForm is the child form name, and locked is either 0:1 where
0: means items should be unlocked (disabled = 0)
1: means items should be locked (disabled = 1)
but this code is passed through to the parent window script
lockAtt(theForm, locked)
the parent window DOESN'T WANT TO CHANGE DISABLED FORM ELEMENTS TO BE ENABLED...
code...
function lockAtt(theForm, locked){
/* currently not changing locked to unlocked */
/*
var i;
for(i=0; i<theForm.elements.length; i++){
var me = theForm.elements[i];
if((me.name.search('pATT_') == -1) && me.name != 'pworkflowAlert' && me.name != 'pinfo' && me.name != 'pcancel'){
/* EVEN THOUGH locked is 0 when unlocked the next line doesn't want to change the disabled attribute to the element to 0:FALSE */
me.disabled = locked;
}
}
*/
}
|
|
"We are what we repeatedly do. Excellence then, is not an act, but a habit." Aristotle
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|