In the rendered page, yes.
The scripts with which I am having the problem are in _changephotos.php view.
My index.php view makes an ajax call that loads _changephotos.php. Both index.php and _changephotos.php use CHtml::ajaxSubmitButton to create the buttons.
Attempting to give just the relevant code, but all of the relevant code:
The index.php button code that calls the _changephotos.php view:
<?php echo CHtml::ajaxButton('Change Photos',array('default/changePhotos'),
array('update'=>'#editScreen',
'data'=>array('bldgId'=>$moneyShot->bldgId,'aptId'=>$moneyShot->aptId,'toAdd'=>'apartment'),
'type'=>'get'),
array('name'=>'changeAptPhotoButton',
'live'=>false)); ?>
The controller command that renders the _changephotos.php view:
$this->renderPartial('_changephotos',array('moneyShot'=>$moneyShot,'toAdd'=>$toAdd),false,false);
The script blocks from my _changephotos.php view:
<script type='text/javascript'>
document.getElementById('editScreen').style.display='block';
</script>
<script type='text/javascript'>
function boxClose(x) {
x.parentNode.style.display='none';
numSpecials--;
if(numSpecials >= numImages) return;
var imgPar=document.getElementById('otherBoxes');
numOthers++;
var imgC=document.createElement("div");
imgC.id="imgContainer"+numOthers;
imgC.className="imgContainer";
imgPar.appendChild(imgC);
var drop=document.createElement("div");
drop.id="dropBox"+numOthers;
drop.className="dropBox";
var param1='event';
drop.ondrop=function(){drop(param1,numOthers)};
drop.ondragover=function(){allowDrop(param1)};
imgC.appendChild(drop);
var inpt=document.createElement("input");
inpt.type="hidden";
inpt.name="other"+numOthers;
inpt.id="imgName"+numOthers;
imgC.appendChild(inpt);
var tinpt=document.createElement("input");
tinpt.type="text";
tinpt.name="otherLabel"+numOthers;
tinpt.id="labelField"+numOthers;
tinpt.value='Other';
tinpt.onfocus=function(){this.select()};
imgC.appendChild(tinpt);
}
</script>
<script type='text/javascript'>
function setListingOrder()
{
document.getElementById('newOrderNote').innerHTML="Click on photos in order they should be displayed in listings"
var numImgs=document.changeOrder.exx.value;
var listingOrder= [];
var imgList= function(thebox){
listingOrder.push(thebox.getElementsByTagName("input")[0].name);
thebox.style.border="3px solid blue";
if(listingOrder.length == numImgs)
writeFields(listingOrder);
}
return imgList;
}
function allowDrop(ev)
{
ev.preventDefault();
}
function drag(ev)
{
ev.dataTransfer.setData("Text",ev.target.id);
}
function drop(ev,x)
{
ev.preventDefault();
var data=ev.dataTransfer.getData("Text");
var droppedItem=document.getElementById(data);
ev.target.appendChild(droppedItem);
var imgName=droppedItem.value; //this might not work. Is value the FILE or the FILENAME?
ev.target.parent.onclick=function(){addToList(this)};
document.getElementById('imgName'+x).value=imgName;
var dr=document.getElementById('curOrder');
if(dr.getElementsByTagName('img').length==0)
addToList=setListingOrder();
}
function dropNotPublic(ev)
{
ev.preventDefault();
var data=ev.dataTransfer.getData("Text");
ev.target.appendChild(document.getElementById(data));
var npn=document.getElementById('notPublicNames');
var children = npn.childNodes;
var nfnum=children.length++;
inpt=document.createElement("input");
inpt.type="hidden";
inpt.name="notPublic[]";
inpt.id="notPublic"+nfnum;
inpt.value=document.getElementById(data).value;
npn.appendChild(inpt);
var dr=document.getElementById('curOrder');
if(dr.getElementsByTagName('img').length==0)
addToList=setListingOrder();
}
function writeFields(imageList) {
var npn=document.getElementById("newOrder");
for (var x=0; x<imageList.length; x++) {
var inpt=document.createElement("input");
inpt.type="hidden";
inpt.name="imageList["+x+"]";
inpt.value=imageList[x];
npn.appendChild(inpt);
}
}
var addToList;
</script>
Elsewhere in the _changephotos.php view I have two CHtml::ajaxSubmitButton calls
I have just started troubleshooting this code.
Thank you for your time.