Hi Bruno,

No I didn't try this the Label idea... I'll give it a go!

Thanks for the link I'll let you know how it works out ... watch this space!



Bruno Cesar Borges wrote:
> 
> Did you try to add a Label with CSS hidden attribute that executes your
> script? Something like this:
> 
> <div style="display:none;">
>   <script>myJavascriptMethod();</script>
> </div>
> 
> I'm really not sure if this actually works, but you could also check this
> Wiki page (yeah, it exists)
> 
> http://cwiki.apache.org/WICKET/howto-do-javscript-call-after-each-wicket-ajax-update.html
> 
> cheers,
> Bruno
> 
> -----Original Message-----
> From: Graeme Knight [mailto:[EMAIL PROTECTED]
> Sent: Monday, December 08, 2008 12:12 PM
> To: [email protected]
> Subject: Re: Populate IFRAME innerHTML on AJAX load of panel.
> 
> 
> 
> Hi Bruno,
> 
> Right, that far I DID get. I have a Javascript file that contains the
> required Javascript for my editor. 
> 
> (Sorry, I don't have the code now):
> 
> When the user hits the tab and the panel goes into another context I
> create
> the panel, add a HeaderContributor that adds the Javascript file. 
> 
> This panel is not created via a page refresh - it is replaced as per the
> code above (i.e. currentPanel = new .... ). Will the HeaderContributor
> actually be utilized at this point or is a full page refresh required?
> 
> My BIG problem (this is the crux) is HOW to call that Javascript function
> -
> the call to 'popupateContent' effectively has to be AFTER the iframe is
> initialized (so an innerHTML exists). This can't be part of a
> HeaderContributor - it has to be further down the chain of execution. My
> confusion is how to make this happen.
> 
> Almost there! What are the guidelines for the Wiki when I get this
> working?
> Perhaps I can submit to the Wicket people for verification?
> 
> REALLY appreciate your discussion on this.
> 
> Cheers, Graeme.
> 
> 
> Bruno Cesar Borges wrote:
>> 
>> Put that code into some .js file and add it to your panel as a
>> HeaderContributor. Then you are ready to go.
>> 
>> -----Original Message-----
>> From: Graeme Knight [mailto:[EMAIL PROTECTED]
>> Sent: Monday, December 08, 2008 11:48 AM
>> To: [email protected]
>> Subject: Re: Populate IFRAME innerHTML on AJAX load of panel.
>> 
>> 
>> 
>> Hey Bruno,
>> 
>> Perhaps my ramblings with myself didn't make myself clear.
>> 
>> I am simply wanting to populate the innerHTML with content. I have it
>> working wonderfully with Tapestry but not with Wicket as I'm not sure of
>> the
>> correct way of doing it.
>> 
>> Essentially my component will be a wysiwyg editor. I don't want to use
>> standard ones because I have written my own AND I will be doing some
>> fancy
>> stuff with the content at a later date.
>> 
>> So perhaps here's the correct question:
>> 
>> What's the best way to set innerHTML on an iframe?
>> 
>> I have a javascript function that I would like to call, which is
>> something
>> like the following:
>> 
>>      IFrameArea.populateContent = function( isEditable, allowDocumentTags,
>> content )
>>      {
>>              var iFrame = document.getElementById( IFrameArea.FRAME_NAME );
>>              
>>              if( iFrame.contentWindow != null )
>>              {
>>                      if( iFrame.contentWindow.document != null )
>>                      {
>>                              var iFrameDocument = 
>> iFrame.contentWindow.document;
>>                                                                              
>>                              iFrameDocument.open();
>>                              
>>                              if( allowDocumentTags == true )
>>                              {
>>                                      iFrameDocument.write('<html><head>');
>>      
>>                                      iFrameDocument.write( '<link 
>> rel="stylesheet" type="text/css"
>> href="styles/IFrameStyle.css">' );
>>                                                                              
>>         
>>                              iFrameDocument.write('</head><body>');
>>                              }
>>                              
>>                              iFrameDocument.write( content );                
>>                         
>>      
>>                              if( allowDocumentTags == true )
>>                              {
>>                                      iFrameDocument.write('</body></html>');
>>                              }
>>                              
>>                              iFrameDocument.close();     
>>                              
>>                              if( isEditable == true )
>>                              {                                       
>>                                      IFrameArea.designModeOn();
>>                              }
>>                      }
>>              }
>>      };
>> 
>> isEditable indicates whether the iframe is editable or not,
>> allowDocumentTags indicates whether the iframe should contain basic html
>> tags and CSS, and the content is ... the content (created by the server)
>> -
>> this is my Tapestry-esq implementation, so of course it is open to
>> change.
>> 
>> The magic question: How do I get this in the HTML for the 'context'
>> panel?
>> 
>> 
>> Bruno Borges wrote:
>>> 
>>> I've just read your thread and looks like what you want to do is
>>> quite...
>>> invalid. Iframes are just like normal frames, or even, a separate
>>> window/tab. If you think that way, you will notice that what you want to
>>> do
>>> is not possible. From a Javascript developer's perspective, of course.
>>> This
>>> has nothing to do with Wicket.
>>> 
>>> If you want to set the innerHTML property of some DOM object, that
>>> object
>>> *has* to have that property. Check these URLs:
>>> 
>>> http://www.htmlite.com/lite021.php
>>> http://msdn.microsoft.com/en-us/library/ms535258(VS.85).aspx#
>>> 
>>> So, stop talking with yourself about something impossible to accomplish
>>> and
>>> go get some sleep buddy... ;-)
>>> 
>>> Cheers,
>>> Bruno Borges
>>> blog.brunoborges.com.br
>>> +55 21 76727099
>>> 
>>> "The glory of great men should always be
>>> measured by the means they have used to
>>> acquire it."
>>> - Francois de La Rochefoucauld
>>> 
>>> 
>>> On Mon, Dec 8, 2008 at 1:07 AM, Graeme Knight <[EMAIL PROTECTED]>
>>> wrote:
>>> 
>>>>
>>>> Bruno!
>>>>
>>>> I absolutely would love to write a wiki page on this if I can make it
>>>> work
>>>> -
>>>> and you are right - conversation with myself *might* help others who
>>>> perhaps
>>>> have a similar problem.
>>>>
>>>> I'm not quite there yet :-( - perhaps tomorrow!
>>>>
>>>> Cheers, Graeme.
>>>>
>>>>
>>>> Bruno Borges wrote:
>>>> >
>>>> > With all that conversation with yourself, how about writing a Wiki
>>>> page
>>>> > after you succeed ?! :-D
>>>> >
>>>> > Cheers,
>>>> > Bruno Borges
>>>> > blog.brunoborges.com.br
>>>> > +55 21 76727099
>>>> >
>>>> > "The glory of great men should always be
>>>> > measured by the means they have used to
>>>> > acquire it."
>>>> > - Francois de La Rochefoucauld
>>>> >
>>>> >
>>>> > On Sun, Dec 7, 2008 at 11:51 PM, Graeme Knight <[EMAIL PROTECTED]>
>>>> > wrote:
>>>> >
>>>> >>
>>>> >> Hi.
>>>> >>
>>>> >> I'm making some progress by using an IPageLink to a page that might
>>>> >> contain
>>>> >> (if I can) the rendered content... HHmm...
>>>> >>
>>>> >> Cheers, Graeme.
>>>> >>
>>>> >>
>>>> >> Graeme Knight wrote:
>>>> >> >
>>>> >> > Hi.
>>>> >> >
>>>> >> > I have an application with links that switch panels using AJAX:
>>>> >> >
>>>> >> >     :
>>>> >> >     private Panel currentPanel;
>>>> >> >     :
>>>> >> >     ContactsListPanel manageContactsPanel = new
>>>> ContactsListPanel();
>>>> >> >
>>>> >> >     currentPanel.replaceWith( manageContactsPanel );
>>>> >> >
>>>> >> >     currentPanel = manageContactsPanel;
>>>> >> >     :
>>>> >> >
>>>> >> > One of my panels has an IFRAME on it which I wish to populate with
>>>> >> content
>>>> >> > on rendering. I would like to set the innerHTML through
>>>> Javascript,
>>>> >> rather
>>>> >> > than set the SRC (the innerHTML will be injected with content that
>>>> is
>>>> >> > modified on the server and not a static source page).
>>>> >> >
>>>> >> > I have a Javascript function that can be called once the IFRAME
>>>> has
>>>> >> > (effectively) been rendered (using a Variables Model for replacing
>>>> >> > 'originalContent' with text):
>>>> >> >
>>>> >> > function initializeIFrameArea()
>>>> >> > {
>>>> >> >       IFrameArea.populateContent( "${originalContent}" );
>>>> >> > }
>>>> >> >
>>>> >> > The populateContent function simply sets the innerHTML on the
>>>> IFRAME.
>>>> >> The
>>>> >> > 'originalContent' is my modified content to be injected into the
>>>> >> > innerHTML.
>>>> >> >
>>>> >> > My question is this:
>>>> >> >
>>>> >> > 1) On entering the panel, I was wondering if it is possible to use
>>>> a
>>>> >> > HeaderContributor (i.e. this is NOT a full page rerender) to add
>>>> the
>>>> >> > script containing the IFrameArea Javascript on which the
>>>> >> populateContent
>>>> >> > is called. I can't have the initializeIFrameArea function on the
>>>> page
>>>> >> from
>>>> >> > the start because I am using a Variables Model to change the value
>>>> of
>>>> >> > originalContent on the fly (i.e. when the user enters this panel
>>>> the
>>>> >> > content could be one of many possibilities).
>>>> >> >
>>>> >> > 2) On rendering I want to be able to call initializeIFrameArea,
>>>> but
>>>> I
>>>> >> do
>>>> >> > not understand how I can get this into the HTML of the panel so
>>>> that
>>>> it
>>>> >> > calls the function after the IFRAME is effectively rendered and
>>>> >> innerHTML
>>>> >> > exists.
>>>> >> >
>>>> >> > Perhaps there is a better approach - as this seems complicated (I
>>>> had
>>>> >> to
>>>> >> > do this with Tapestry, so I'm not sure if Wicket has a more
>>>> elegant
>>>> >> > approach).
>>>> >> >
>>>> >> > Any thoughts most welcome.
>>>> >> >
>>>> >> > Thanks, Graeme.
>>>> >> >
>>>> >>
>>>> >> --
>>>> >> View this message in context:
>>>> >>
>>>> http://www.nabble.com/Populate-IFRAME-innerHTML-on-AJAX-load-of-panel.-tp20887803p20888407.html
>>>> >> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>> >>
>>>> >>
>>>> >>
>>>> ---------------------------------------------------------------------
>>>> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>> >> For additional commands, e-mail: [EMAIL PROTECTED]
>>>> >>
>>>> >>
>>>> >
>>>> >
>>>> > -----
>>>> > Bruno Borges
>>>> > blog.brunoborges.com.br
>>>> > +55 21 76727099
>>>> >
>>>> > "The glory of great men should always be
>>>> > measured by the means they have used to
>>>> > acquire it."
>>>> > - Francois de La Rochefoucauld
>>>> >
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/Populate-IFRAME-innerHTML-on-AJAX-load-of-panel.-tp20887803p20888901.html
>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>>
>>>>
>>> 
>>> 
>>> -----
>>> Bruno Borges
>>> blog.brunoborges.com.br
>>> +55 21 76727099
>>> 
>>> "The glory of great men should always be
>>> measured by the means they have used to
>>> acquire it."
>>> - Francois de La Rochefoucauld
>>> 
>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/Populate-IFRAME-innerHTML-on-AJAX-load-of-panel.-tp20887803p20895692.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> 
>> ***************************************************************************************************
>> "Atenção: Esta mensagem foi enviada para uso exclusivo do(s)
>> destinatários(s) acima identificado(s),
>> podendo conter informações e/ou documentos confidencias/privilegiados e
>> seu sigilo é protegido por 
>> lei. Caso você tenha recebido por engano, por favor, informe o remetente
>> e
>> apague-a de seu sistema.
>> Notificamos que é proibido por lei a sua retenção, disseminação,
>> distribuição, cópia ou uso sem 
>> expressa autorização do remetente. Opiniões pessoais do remetente não
>> refletem, necessariamente, 
>> o ponto de vista da CETIP, o qual é divulgado somente por pessoas
>> autorizadas."
>> 
>> 
>> "Warning: This message was sent for exclusive use of the addressees above
>> identified, possibly 
>> containing information and or privileged/confidential documents whose
>> content is protected by law. 
>> In case you have mistakenly received it, please notify the sender and
>> delete it from your system. 
>> Be noticed that the law forbids the retention, dissemination,
>> distribution, copy or use without 
>> express authorization from the sender. Personal opinions of the sender do
>> not necessarily reflect 
>> CETIP's point of view, which is only divulged by authorized personnel."
>> ***************************************************************************************************
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> 
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/Populate-IFRAME-innerHTML-on-AJAX-load-of-panel.-tp20887803p20896023.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> ***************************************************************************************************
> "Atenção: Esta mensagem foi enviada para uso exclusivo do(s)
> destinatários(s) acima identificado(s),
> podendo conter informações e/ou documentos confidencias/privilegiados e
> seu sigilo é protegido por 
> lei. Caso você tenha recebido por engano, por favor, informe o remetente e
> apague-a de seu sistema.
> Notificamos que é proibido por lei a sua retenção, disseminação,
> distribuição, cópia ou uso sem 
> expressa autorização do remetente. Opiniões pessoais do remetente não
> refletem, necessariamente, 
> o ponto de vista da CETIP, o qual é divulgado somente por pessoas
> autorizadas."
> 
> 
> "Warning: This message was sent for exclusive use of the addressees above
> identified, possibly 
> containing information and or privileged/confidential documents whose
> content is protected by law. 
> In case you have mistakenly received it, please notify the sender and
> delete it from your system. 
> Be noticed that the law forbids the retention, dissemination,
> distribution, copy or use without 
> express authorization from the sender. Personal opinions of the sender do
> not necessarily reflect 
> CETIP's point of view, which is only divulged by authorized personnel."
> ***************************************************************************************************
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Populate-IFRAME-innerHTML-on-AJAX-load-of-panel.-tp20887803p20896309.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to