Partial Render / Facebox / Script Visibility

Hi Guys

If I scratch my head anymore i will have no hair left. haha.

And this might be very simple but is a bit hard to explain. I have a page with a button that launches a form (project/form) in a modal. (The popup modal uses facebox, which gives it a nice look) now the form has a number of date fields uses bootstrap date, and a save button that submits via ajax using (CHtml::ajaxSubmitButton) in order for ajax submission to work the view uses

$this->renderPartial('_createform', array('model'=>$model), false, true); 

for some reason, if I go to project/form directly with URL Not via the popup modal, everything works fine, however via the popup modal, it failed to load boostrapdate script. firebug complains about “TypeError: date is undefined”, I just don’t understand why it doesn’t get loaded.

Seems to me it’s a visibility issues, Yii is removing script fields inside a partialrender.

Anyone would have any ideas?

Thanks in advance.

Best Regards


Would that be the issue, that when you go directly, a standard render is used to render the page, and when you open it in a modal, renderPartial is used?

If so, then check, if renderPartial is registering any scripts, because if I’m not mistaken - it doesn’t. Client scripts are registered (put to assets and made availalbe to the application) only when fully registering page.

But, I’m writing from my memory, so this could be a dead end.

Hi Trejder, thanks for replying you are spot on I think, I was stuck in a rock and a hard place, I needed partialrender for ajaxSubmitbutton to work and modal for the presentation. I just done some other testing, initially i thought was a script scope issue, but that didn’t work and thankfully facebox has a callback function which I could use to re-initialize the script and that worked (thanks to Ruli’s suggestion from yii facebook page).