Re: How to Show a Div using Javascript

2020-10-08 Thread Thiago H. de Paula Figueiredo
On Mon, Oct 5, 2020 at 9:28 AM marwa hussein 
wrote:

> On Mon, Oct 5, 2020, 2:22 PM Thiago H. de Paula Figueiredo <
> thiag...@gmail.com> wrote:
>
> > On Sun, Oct 4, 2020 at 8:37 AM marwa hussein 
> > wrote:
> >
> > > Hi Thiago,
> > >
> >
> > Hello!
> >
> >
> > > Thanks a lot for your reply it works fine but the problem is using this
> > > line of code in beginRender() function shows the "div" when the page is
> > > loaded. but What I want is to show the div after a button is pressed.
> > >
> >
> > In this case, just write the same JavaScript you'd do as if you weren't
> > using Tapestry.
> >
>
>  Do you mean to write a JS function and call it from the onSubmit()
> function and not to use JavaScript support?.
>

No. Write it in a .js file you include in the page. That's what I meant by
writing the same JS as if you weren't using Tapestry.

-- 
Thiago


Re: How to Show a Div using Javascript

2020-10-05 Thread marwa hussein
On Mon, Oct 5, 2020, 2:22 PM Thiago H. de Paula Figueiredo <
thiag...@gmail.com> wrote:

> On Sun, Oct 4, 2020 at 8:37 AM marwa hussein 
> wrote:
>
> > Hi Thiago,
> >
>
> Hello!
>
>
> > Thanks a lot for your reply it works fine but the problem is using this
> > line of code in beginRender() function shows the "div" when the page is
> > loaded. but What I want is to show the div after a button is pressed.
> >
>
> In this case, just write the same JavaScript you'd do as if you weren't
> using Tapestry.
>

 Do you mean to write a JS function and call it from the onSubmit()
function and not to use JavaScript support?.

>
>
> > When I used this line of code in the onSubmit() button function it gives
> > me  "No object of type
> > org.apache.tapestry5.services.javascript.JavaScriptSupport is available
> > from the Environment" exception!!
> >
>
> JavaScriptSupport is only available when the component is being rendered.
> Form submission is not done during rendering, so you get this exception.
>
> --
> Thiago
>


Re: How to Show a Div using Javascript

2020-10-05 Thread Thiago H. de Paula Figueiredo
On Sun, Oct 4, 2020 at 8:37 AM marwa hussein 
wrote:

> Hi Thiago,
>

Hello!


> Thanks a lot for your reply it works fine but the problem is using this
> line of code in beginRender() function shows the "div" when the page is
> loaded. but What I want is to show the div after a button is pressed.
>

In this case, just write the same JavaScript you'd do as if you weren't
using Tapestry.


> When I used this line of code in the onSubmit() button function it gives
> me  "No object of type
> org.apache.tapestry5.services.javascript.JavaScriptSupport is available
> from the Environment" exception!!
>

JavaScriptSupport is only available when the component is being rendered.
Form submission is not done during rendering, so you get this exception.

-- 
Thiago


Re: How to Show a Div using Javascript

2020-10-04 Thread marwa hussein
Hi Thiago,

Thanks a lot for your reply it works fine but the problem is using this
line of code in beginRender() function shows the "div" when the page is
loaded. but What I want is to show the div after a button is pressed.
When I used this line of code in the onSubmit() button function it gives
me  "No object of type
org.apache.tapestry5.services.javascript.JavaScriptSupport is available
from the Environment" exception!!
Could you explain this for me?

Regards,
Marwa

On Sat, Oct 3, 2020 at 10:01 PM Thiago H. de Paula Figueiredo <
thiag...@gmail.com> wrote:

> Hello!
>
> @Inject private JavaScriptSuport javaScriptSupport;
>
> void beginRender() {
>
> javaScriptSupport.addScript("document.getElementById("div1").style.display
> = '';");
> }
>
> On Sat, Oct 3, 2020 at 10:06 AM marwa hussein 
> wrote:
>
> > Hello all,
> > I am new to Tapestry and to Web development in general but I have to
> > implement a simple web application for my research.
> >
> > I use a div that when loading the page I need to hide it, so I use this
> > line:
> >  
> > The div contains "inside it" a grid that will contain some elements
> after a
> > "load" button is pressed.
> > how can I unhide the div again "after pressing the load button"?
> >
> > I know that I could do this with JS Line of code like:
> >  document.getElementById("div1").style.display ="";
> > But how and where can I add a javascrpt line of code directly in my Java
> > class?
> >
> > Thansk in advance
> >
> > --
> >
> >
> >
> > *Marwa Hussein M. TA @ Information Systems Department Faculty of
> Computers
> > & Information Assuit University*
> > 
> >
>
>
> --
> Thiago
>


-- 



*Marwa Hussein M. TA @ Information Systems Department Faculty of Computers
& Information Assuit University*



Re: How to Show a Div using Javascript

2020-10-03 Thread Thiago H. de Paula Figueiredo
Hello!

@Inject private JavaScriptSuport javaScriptSupport;

void beginRender() {

javaScriptSupport.addScript("document.getElementById("div1").style.display
= '';");
}

On Sat, Oct 3, 2020 at 10:06 AM marwa hussein 
wrote:

> Hello all,
> I am new to Tapestry and to Web development in general but I have to
> implement a simple web application for my research.
>
> I use a div that when loading the page I need to hide it, so I use this
> line:
>  
> The div contains "inside it" a grid that will contain some elements after a
> "load" button is pressed.
> how can I unhide the div again "after pressing the load button"?
>
> I know that I could do this with JS Line of code like:
>  document.getElementById("div1").style.display ="";
> But how and where can I add a javascrpt line of code directly in my Java
> class?
>
> Thansk in advance
>
> --
>
>
>
> *Marwa Hussein M. TA @ Information Systems Department Faculty of Computers
> & Information Assuit University*
> 
>


-- 
Thiago