Re: How I get the internal html content of a dynamically updated div tag using Apache Wicket
Hi, On Mon, Jun 3, 2013 at 10:35 PM, Andun Sameera wrote: > Hi All, > > I have tried further with AjaxEditableLabel in following way to get the > cotent of div tag. > > String value="Type."; > AjaxEditableLabel ajaxEditableLabel=new > AjaxEditableLabel("editorArea",new Model(value)){ > @Override > public void onEdit(AjaxRequestTarget target){ > String value=getEditor().getValue(); > System.out.println(value); > } > @Override > protected void onModelChanged() { > String value=getEditor().getValue(); > System.out.println(value); > } > @Override > protected void onModelChanging() { > String value=getEditor().getValue(); > System.out.println(value); > } > protected void onSubmit(AjaxRequestTarget target){ > String value=getEditor().getValue(); > System.out.println(value); > } > }; > ajaxEditableLabel.setOutputMarkupId(true); > ajaxEditableLabel.setMarkupId("editorArea"); > form.add(ajaxEditableLabel); > > When this applies Wysiwyg is working properly. The markup is updated. But > the onEdit,onModelChaging methods are not invoked to update the model > object value. Thus what will be the way to get the updated cotent from the > ajax editable label? > The correct way is to use AjaxEditableLabel's model. > > Thanks! > On Mon, Jun 3, 2013 at 5:17 AM, Andun Sameera wrote: > > > Hi All, > > > > Also cant we use AjaxEditableMultiLineLabel which is used in [1] for the > > task? > > > > Thanks! > > > > [1] - > > > http://www.wicket-library.com/wicket-examples/ajax/wicket/bookmarkable/org.apache.wicket.examples.source.SourcesPage?1&SourcesPage_class=org.apache.wicket.examples.ajax.builtin.EditableLabelPage > > > > > > On Sun, Jun 2, 2013 at 10:24 AM, Maxim Solodovnik >wrote: > > > >> Hello Martin, > >> > >> Thanks for the reply > >> > >> Is it possible to wrap component into its own form and add some behavior > >> which will trigger adding DynamicExtraParameters on "upper" form submit? > >> > >> I have added new AjaxFormSubmitBehavior(this, "submit") to my "component > >> form" but it is not triggered on "upper form submit :( > >> > >> > >> > >> > >> On Sat, Jun 1, 2013 at 3:25 PM, Martin Grigorov >> >wrote: > >> > >> > Hi Maxim, > >> > > >> > It depends what is the markup you have to work with. > >> > Usually WYSIWYG widgets work with just a or and > create > >> > other HTML elements dynamically with JavaScript to do their job, e.g. > an > >> > . > >> > Additionally they almost always give you API to get the produced rich > >> > content (html, markdown, ...). > >> > For example: > >> > var richEditor = $.myWysiwyg("#myTextArea"); > >> > var richContent = richEditor.getContent(); > >> > > >> > doSomethingWithRichContent(richContent); > >> > > >> > So it is not always possible to create 1:1 mapping between the client > >> and > >> > the server usage of form components. > >> > > >> > > >> > > >> > On Sat, Jun 1, 2013 at 11:11 AM, Maxim Solodovnik < > solomax...@gmail.com > >> > >wrote: > >> > > >> > > Hello Martin, > >> > > > >> > > Is it possible to create FormComponentPanel as in following example > >> > > > >> > > > >> > > >> > https://cwiki.apache.org/WICKET/creating-custom-formcomponentpanels-to-build-valid-objects-using-wickets-form-validation-logic.html > >> > > > >> > > but taking the value from the div.innerHtml and not the textfield? > >> > > > >> > > > >> > > On Sat, Jun 1, 2013 at 2:19 PM, Martin Grigorov < > mgrigo...@apache.org > >> > > >wrote: > >> > > > >> > > > Hi, > >> > > > > >> > > > I guess you want to get the new entered text via Ajax submit. > >> > > > You can extend AjaxSubmitButton and implement > >> #updateAjaxAttributes() { > >> > > > > >> > > >attributes.getDynamicExtraParameters().add("return [ {name: > >> > > 'richText', > >> > > > value: $('#editorArea').html() } ]"); > >> > > > } > >> > > > > >> > > > Then use > >> > > > > >> > > > > >> > > > >> > > >> > getRequest().getRequestParameters().getParameterValue("richText").toString() > >> > > > to get the produced HTML. > >> > > > > >> > > > > >> > > > On Sat, Jun 1, 2013 at 8:04 AM, Andun Sameera > > >> > > wrote: > >> > > > > >> > > > > Hi, > >> > > > > > >> > > > > In my html file I have a div tag like this, > >> > > > > > >> > > > > Type Here > >> > > > > > >> > > > > I am using a JavaScript library called bootstrap-wysiwyg to make > >> this > >> > > > > div tag a text are which we can type rich text. When the person > >> types > >> > > > > text, div tag's html content updates to represent the text > >> content in > >> > > > > html. I want to retrieve it in to the Java code of the html file > >> in > >> > > > > wicket. I tried to do it by creating reference variable to div > tag > >> > > > > like following, > >> > > >
Re: How I get the internal html content of a dynamically updated div tag using Apache Wicket
Hi All, I have tried further with AjaxEditableLabel in following way to get the cotent of div tag. String value="Type."; AjaxEditableLabel ajaxEditableLabel=new AjaxEditableLabel("editorArea",new Model(value)){ @Override public void onEdit(AjaxRequestTarget target){ String value=getEditor().getValue(); System.out.println(value); } @Override protected void onModelChanged() { String value=getEditor().getValue(); System.out.println(value); } @Override protected void onModelChanging() { String value=getEditor().getValue(); System.out.println(value); } protected void onSubmit(AjaxRequestTarget target){ String value=getEditor().getValue(); System.out.println(value); } }; ajaxEditableLabel.setOutputMarkupId(true); ajaxEditableLabel.setMarkupId("editorArea"); form.add(ajaxEditableLabel); When this applies Wysiwyg is working properly. The markup is updated. But the onEdit,onModelChaging methods are not invoked to update the model object value. Thus what will be the way to get the updated cotent from the ajax editable label? Thanks! On Mon, Jun 3, 2013 at 5:17 AM, Andun Sameera wrote: > Hi All, > > Also cant we use AjaxEditableMultiLineLabel which is used in [1] for the > task? > > Thanks! > > [1] - > http://www.wicket-library.com/wicket-examples/ajax/wicket/bookmarkable/org.apache.wicket.examples.source.SourcesPage?1&SourcesPage_class=org.apache.wicket.examples.ajax.builtin.EditableLabelPage > > > On Sun, Jun 2, 2013 at 10:24 AM, Maxim Solodovnik wrote: > >> Hello Martin, >> >> Thanks for the reply >> >> Is it possible to wrap component into its own form and add some behavior >> which will trigger adding DynamicExtraParameters on "upper" form submit? >> >> I have added new AjaxFormSubmitBehavior(this, "submit") to my "component >> form" but it is not triggered on "upper form submit :( >> >> >> >> >> On Sat, Jun 1, 2013 at 3:25 PM, Martin Grigorov > >wrote: >> >> > Hi Maxim, >> > >> > It depends what is the markup you have to work with. >> > Usually WYSIWYG widgets work with just a or and create >> > other HTML elements dynamically with JavaScript to do their job, e.g. an >> > . >> > Additionally they almost always give you API to get the produced rich >> > content (html, markdown, ...). >> > For example: >> > var richEditor = $.myWysiwyg("#myTextArea"); >> > var richContent = richEditor.getContent(); >> > >> > doSomethingWithRichContent(richContent); >> > >> > So it is not always possible to create 1:1 mapping between the client >> and >> > the server usage of form components. >> > >> > >> > >> > On Sat, Jun 1, 2013 at 11:11 AM, Maxim Solodovnik > > >wrote: >> > >> > > Hello Martin, >> > > >> > > Is it possible to create FormComponentPanel as in following example >> > > >> > > >> > >> https://cwiki.apache.org/WICKET/creating-custom-formcomponentpanels-to-build-valid-objects-using-wickets-form-validation-logic.html >> > > >> > > but taking the value from the div.innerHtml and not the textfield? >> > > >> > > >> > > On Sat, Jun 1, 2013 at 2:19 PM, Martin Grigorov > > > >wrote: >> > > >> > > > Hi, >> > > > >> > > > I guess you want to get the new entered text via Ajax submit. >> > > > You can extend AjaxSubmitButton and implement >> #updateAjaxAttributes() { >> > > > >> > > >attributes.getDynamicExtraParameters().add("return [ {name: >> > > 'richText', >> > > > value: $('#editorArea').html() } ]"); >> > > > } >> > > > >> > > > Then use >> > > > >> > > > >> > > >> > >> getRequest().getRequestParameters().getParameterValue("richText").toString() >> > > > to get the produced HTML. >> > > > >> > > > >> > > > On Sat, Jun 1, 2013 at 8:04 AM, Andun Sameera >> > > wrote: >> > > > >> > > > > Hi, >> > > > > >> > > > > In my html file I have a div tag like this, >> > > > > >> > > > > Type Here >> > > > > >> > > > > I am using a JavaScript library called bootstrap-wysiwyg to make >> this >> > > > > div tag a text are which we can type rich text. When the person >> types >> > > > > text, div tag's html content updates to represent the text >> content in >> > > > > html. I want to retrieve it in to the Java code of the html file >> in >> > > > > wicket. I tried to do it by creating reference variable to div tag >> > > > > like following, >> > > > > >> > > > > WebMarkupContainer editorArea=new >> WebMarkupContainer("editorArea"); >> > > > > String text=editorArea.getMarkup().toString(true) >> > > > > >> > > > > But this don't give me the updated HTML content. I give only the >> > > > > initial html content. what is the problem here? >> > > > > >> > > > > Thanks! >> > > > > >> > > > > -- >> > > > > Regards >> > > > > Andun S.L. Gunawardana >> > > > > Undergraduate >> > > > > Department of Computer Science And Engin
Re: How I get the internal html content of a dynamically updated div tag using Apache Wicket
Hi All, Also cant we use AjaxEditableMultiLineLabel which is used in [1] for the task? Thanks! [1] - http://www.wicket-library.com/wicket-examples/ajax/wicket/bookmarkable/org.apache.wicket.examples.source.SourcesPage?1&SourcesPage_class=org.apache.wicket.examples.ajax.builtin.EditableLabelPage On Sun, Jun 2, 2013 at 10:24 AM, Maxim Solodovnik wrote: > Hello Martin, > > Thanks for the reply > > Is it possible to wrap component into its own form and add some behavior > which will trigger adding DynamicExtraParameters on "upper" form submit? > > I have added new AjaxFormSubmitBehavior(this, "submit") to my "component > form" but it is not triggered on "upper form submit :( > > > > > On Sat, Jun 1, 2013 at 3:25 PM, Martin Grigorov >wrote: > > > Hi Maxim, > > > > It depends what is the markup you have to work with. > > Usually WYSIWYG widgets work with just a or and create > > other HTML elements dynamically with JavaScript to do their job, e.g. an > > . > > Additionally they almost always give you API to get the produced rich > > content (html, markdown, ...). > > For example: > > var richEditor = $.myWysiwyg("#myTextArea"); > > var richContent = richEditor.getContent(); > > > > doSomethingWithRichContent(richContent); > > > > So it is not always possible to create 1:1 mapping between the client and > > the server usage of form components. > > > > > > > > On Sat, Jun 1, 2013 at 11:11 AM, Maxim Solodovnik > >wrote: > > > > > Hello Martin, > > > > > > Is it possible to create FormComponentPanel as in following example > > > > > > > > > https://cwiki.apache.org/WICKET/creating-custom-formcomponentpanels-to-build-valid-objects-using-wickets-form-validation-logic.html > > > > > > but taking the value from the div.innerHtml and not the textfield? > > > > > > > > > On Sat, Jun 1, 2013 at 2:19 PM, Martin Grigorov > > >wrote: > > > > > > > Hi, > > > > > > > > I guess you want to get the new entered text via Ajax submit. > > > > You can extend AjaxSubmitButton and implement > #updateAjaxAttributes() { > > > > > > > >attributes.getDynamicExtraParameters().add("return [ {name: > > > 'richText', > > > > value: $('#editorArea').html() } ]"); > > > > } > > > > > > > > Then use > > > > > > > > > > > > > > getRequest().getRequestParameters().getParameterValue("richText").toString() > > > > to get the produced HTML. > > > > > > > > > > > > On Sat, Jun 1, 2013 at 8:04 AM, Andun Sameera > > > wrote: > > > > > > > > > Hi, > > > > > > > > > > In my html file I have a div tag like this, > > > > > > > > > > Type Here > > > > > > > > > > I am using a JavaScript library called bootstrap-wysiwyg to make > this > > > > > div tag a text are which we can type rich text. When the person > types > > > > > text, div tag's html content updates to represent the text content > in > > > > > html. I want to retrieve it in to the Java code of the html file in > > > > > wicket. I tried to do it by creating reference variable to div tag > > > > > like following, > > > > > > > > > > WebMarkupContainer editorArea=new WebMarkupContainer("editorArea"); > > > > > String text=editorArea.getMarkup().toString(true) > > > > > > > > > > But this don't give me the updated HTML content. I give only the > > > > > initial html content. what is the problem here? > > > > > > > > > > Thanks! > > > > > > > > > > -- > > > > > Regards > > > > > Andun S.L. Gunawardana > > > > > Undergraduate > > > > > Department of Computer Science And Engineering > > > > > University of Moratuwa > > > > > Sri Lanka > > > > > > > > > > Blog - http://www.insightforfuture.blogspot.com/ > > > > > LinkedIn - > > > http://www.linkedin.com/pub/andun-s-l-gunawardana/34/646/703 > > > > > Twitter -http://twitter.com/AndunSLG > > > > > > > > > > > - > > > > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > > > > > For additional commands, e-mail: users-h...@wicket.apache.org > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > WBR > > > Maxim aka solomax > > > > > > > > > -- > WBR > Maxim aka solomax > -- Regards Andun S.L. Gunawardana Undergraduate Department of Computer Science And Engineering University of Moratuwa Sri Lanka Blog - http://www.insightforfuture.blogspot.com/ LinkedIn - http://www.linkedin.com/pub/andun-s-l-gunawardana/34/646/703 Twitter -http://twitter.com/AndunSLG
Re: How I get the internal html content of a dynamically updated div tag using Apache Wicket
Hello Martin, Thanks for the reply Is it possible to wrap component into its own form and add some behavior which will trigger adding DynamicExtraParameters on "upper" form submit? I have added new AjaxFormSubmitBehavior(this, "submit") to my "component form" but it is not triggered on "upper form submit :( On Sat, Jun 1, 2013 at 3:25 PM, Martin Grigorov wrote: > Hi Maxim, > > It depends what is the markup you have to work with. > Usually WYSIWYG widgets work with just a or and create > other HTML elements dynamically with JavaScript to do their job, e.g. an > . > Additionally they almost always give you API to get the produced rich > content (html, markdown, ...). > For example: > var richEditor = $.myWysiwyg("#myTextArea"); > var richContent = richEditor.getContent(); > > doSomethingWithRichContent(richContent); > > So it is not always possible to create 1:1 mapping between the client and > the server usage of form components. > > > > On Sat, Jun 1, 2013 at 11:11 AM, Maxim Solodovnik >wrote: > > > Hello Martin, > > > > Is it possible to create FormComponentPanel as in following example > > > > > https://cwiki.apache.org/WICKET/creating-custom-formcomponentpanels-to-build-valid-objects-using-wickets-form-validation-logic.html > > > > but taking the value from the div.innerHtml and not the textfield? > > > > > > On Sat, Jun 1, 2013 at 2:19 PM, Martin Grigorov > >wrote: > > > > > Hi, > > > > > > I guess you want to get the new entered text via Ajax submit. > > > You can extend AjaxSubmitButton and implement #updateAjaxAttributes() { > > > > > >attributes.getDynamicExtraParameters().add("return [ {name: > > 'richText', > > > value: $('#editorArea').html() } ]"); > > > } > > > > > > Then use > > > > > > > > > getRequest().getRequestParameters().getParameterValue("richText").toString() > > > to get the produced HTML. > > > > > > > > > On Sat, Jun 1, 2013 at 8:04 AM, Andun Sameera > > wrote: > > > > > > > Hi, > > > > > > > > In my html file I have a div tag like this, > > > > > > > > Type Here > > > > > > > > I am using a JavaScript library called bootstrap-wysiwyg to make this > > > > div tag a text are which we can type rich text. When the person types > > > > text, div tag's html content updates to represent the text content in > > > > html. I want to retrieve it in to the Java code of the html file in > > > > wicket. I tried to do it by creating reference variable to div tag > > > > like following, > > > > > > > > WebMarkupContainer editorArea=new WebMarkupContainer("editorArea"); > > > > String text=editorArea.getMarkup().toString(true) > > > > > > > > But this don't give me the updated HTML content. I give only the > > > > initial html content. what is the problem here? > > > > > > > > Thanks! > > > > > > > > -- > > > > Regards > > > > Andun S.L. Gunawardana > > > > Undergraduate > > > > Department of Computer Science And Engineering > > > > University of Moratuwa > > > > Sri Lanka > > > > > > > > Blog - http://www.insightforfuture.blogspot.com/ > > > > LinkedIn - > > http://www.linkedin.com/pub/andun-s-l-gunawardana/34/646/703 > > > > Twitter -http://twitter.com/AndunSLG > > > > > > > > - > > > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > > > > For additional commands, e-mail: users-h...@wicket.apache.org > > > > > > > > > > > > > > > > > > > -- > > WBR > > Maxim aka solomax > > > -- WBR Maxim aka solomax
Re: How I get the internal html content of a dynamically updated div tag using Apache Wicket
Hi Maxim, It depends what is the markup you have to work with. Usually WYSIWYG widgets work with just a or and create other HTML elements dynamically with JavaScript to do their job, e.g. an . Additionally they almost always give you API to get the produced rich content (html, markdown, ...). For example: var richEditor = $.myWysiwyg("#myTextArea"); var richContent = richEditor.getContent(); doSomethingWithRichContent(richContent); So it is not always possible to create 1:1 mapping between the client and the server usage of form components. On Sat, Jun 1, 2013 at 11:11 AM, Maxim Solodovnik wrote: > Hello Martin, > > Is it possible to create FormComponentPanel as in following example > > https://cwiki.apache.org/WICKET/creating-custom-formcomponentpanels-to-build-valid-objects-using-wickets-form-validation-logic.html > > but taking the value from the div.innerHtml and not the textfield? > > > On Sat, Jun 1, 2013 at 2:19 PM, Martin Grigorov >wrote: > > > Hi, > > > > I guess you want to get the new entered text via Ajax submit. > > You can extend AjaxSubmitButton and implement #updateAjaxAttributes() { > > > >attributes.getDynamicExtraParameters().add("return [ {name: > 'richText', > > value: $('#editorArea').html() } ]"); > > } > > > > Then use > > > > > getRequest().getRequestParameters().getParameterValue("richText").toString() > > to get the produced HTML. > > > > > > On Sat, Jun 1, 2013 at 8:04 AM, Andun Sameera > wrote: > > > > > Hi, > > > > > > In my html file I have a div tag like this, > > > > > > Type Here > > > > > > I am using a JavaScript library called bootstrap-wysiwyg to make this > > > div tag a text are which we can type rich text. When the person types > > > text, div tag's html content updates to represent the text content in > > > html. I want to retrieve it in to the Java code of the html file in > > > wicket. I tried to do it by creating reference variable to div tag > > > like following, > > > > > > WebMarkupContainer editorArea=new WebMarkupContainer("editorArea"); > > > String text=editorArea.getMarkup().toString(true) > > > > > > But this don't give me the updated HTML content. I give only the > > > initial html content. what is the problem here? > > > > > > Thanks! > > > > > > -- > > > Regards > > > Andun S.L. Gunawardana > > > Undergraduate > > > Department of Computer Science And Engineering > > > University of Moratuwa > > > Sri Lanka > > > > > > Blog - http://www.insightforfuture.blogspot.com/ > > > LinkedIn - > http://www.linkedin.com/pub/andun-s-l-gunawardana/34/646/703 > > > Twitter -http://twitter.com/AndunSLG > > > > > > - > > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > > > For additional commands, e-mail: users-h...@wicket.apache.org > > > > > > > > > > > > -- > WBR > Maxim aka solomax >
Re: How I get the internal html content of a dynamically updated div tag using Apache Wicket
Hello Martin, Is it possible to create FormComponentPanel as in following example https://cwiki.apache.org/WICKET/creating-custom-formcomponentpanels-to-build-valid-objects-using-wickets-form-validation-logic.html but taking the value from the div.innerHtml and not the textfield? On Sat, Jun 1, 2013 at 2:19 PM, Martin Grigorov wrote: > Hi, > > I guess you want to get the new entered text via Ajax submit. > You can extend AjaxSubmitButton and implement #updateAjaxAttributes() { > >attributes.getDynamicExtraParameters().add("return [ {name: 'richText', > value: $('#editorArea').html() } ]"); > } > > Then use > > getRequest().getRequestParameters().getParameterValue("richText").toString() > to get the produced HTML. > > > On Sat, Jun 1, 2013 at 8:04 AM, Andun Sameera wrote: > > > Hi, > > > > In my html file I have a div tag like this, > > > > Type Here > > > > I am using a JavaScript library called bootstrap-wysiwyg to make this > > div tag a text are which we can type rich text. When the person types > > text, div tag's html content updates to represent the text content in > > html. I want to retrieve it in to the Java code of the html file in > > wicket. I tried to do it by creating reference variable to div tag > > like following, > > > > WebMarkupContainer editorArea=new WebMarkupContainer("editorArea"); > > String text=editorArea.getMarkup().toString(true) > > > > But this don't give me the updated HTML content. I give only the > > initial html content. what is the problem here? > > > > Thanks! > > > > -- > > Regards > > Andun S.L. Gunawardana > > Undergraduate > > Department of Computer Science And Engineering > > University of Moratuwa > > Sri Lanka > > > > Blog - http://www.insightforfuture.blogspot.com/ > > LinkedIn - http://www.linkedin.com/pub/andun-s-l-gunawardana/34/646/703 > > Twitter -http://twitter.com/AndunSLG > > > > - > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > > For additional commands, e-mail: users-h...@wicket.apache.org > > > > > -- WBR Maxim aka solomax
Re: How I get the internal html content of a dynamically updated div tag using Apache Wicket
Hi, I guess you want to get the new entered text via Ajax submit. You can extend AjaxSubmitButton and implement #updateAjaxAttributes() { attributes.getDynamicExtraParameters().add("return [ {name: 'richText', value: $('#editorArea').html() } ]"); } Then use getRequest().getRequestParameters().getParameterValue("richText").toString() to get the produced HTML. On Sat, Jun 1, 2013 at 8:04 AM, Andun Sameera wrote: > Hi, > > In my html file I have a div tag like this, > > Type Here > > I am using a JavaScript library called bootstrap-wysiwyg to make this > div tag a text are which we can type rich text. When the person types > text, div tag's html content updates to represent the text content in > html. I want to retrieve it in to the Java code of the html file in > wicket. I tried to do it by creating reference variable to div tag > like following, > > WebMarkupContainer editorArea=new WebMarkupContainer("editorArea"); > String text=editorArea.getMarkup().toString(true) > > But this don't give me the updated HTML content. I give only the > initial html content. what is the problem here? > > Thanks! > > -- > Regards > Andun S.L. Gunawardana > Undergraduate > Department of Computer Science And Engineering > University of Moratuwa > Sri Lanka > > Blog - http://www.insightforfuture.blogspot.com/ > LinkedIn - http://www.linkedin.com/pub/andun-s-l-gunawardana/34/646/703 > Twitter -http://twitter.com/AndunSLG > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >