Automatic navigation?

34 views
Skip to first unread message

Joz Private

unread,
Nov 20, 2012, 10:33:57 AM11/20/12
to rubyonra...@googlegroups.com
Instead of asking the user to click on links to navigate to a new page,
how can I implement automatic page navigation?

I would imagine there is a method something like:

if condition then move_to :controller => ... :action => ...


Is there??

--
Posted via http://www.ruby-forum.com/.

Colin Law

unread,
Nov 20, 2012, 10:41:34 AM11/20/12
to rubyonra...@googlegroups.com
On 20 November 2012 15:33, Joz Private <li...@ruby-forum.com> wrote:
> Instead of asking the user to click on links to navigate to a new page,
> how can I implement automatic page navigation?
>
> I would imagine there is a method something like:
>
> if condition then move_to :controller => ... :action => ...

You can do this at the client end using javascript. Use the
setTimeout method. See
http://www.tizag.com/javascriptT/javascriptredirect.php for example.

Colin

Joz Private

unread,
Nov 22, 2012, 4:46:11 AM11/22/12
to rubyonra...@googlegroups.com
Is there a way to do this without Javascript?

I haven't used it before. For my Rails stuff at the moment (I'm just
learning it) I want to stick to mainly Ruby and HTML, as that's all I
really know at this stage ...

Colin Law

unread,
Nov 22, 2012, 5:37:02 AM11/22/12
to rubyonra...@googlegroups.com
On 22 November 2012 09:46, Joz Private <li...@ruby-forum.com> wrote:

Please quote the previous message so that it is easier to follow the
thread. The only way anyone reading this will know what you are
talking about is by looking back at the earlier email.

> Is there a way to do this without Javascript?

Not as far as I am aware.

>
> I haven't used it before. For my Rails stuff at the moment (I'm just
> learning it) I want to stick to mainly Ruby and HTML, as that's all I
> really know at this stage ...

In that case you will have to stick to basic features until you can
get round to learning about javascript - which is essential for
anything other than a basic site. You will also need CSS knowledge.

Colin

Joz Private

unread,
Nov 22, 2012, 5:48:44 AM11/22/12
to rubyonra...@googlegroups.com
Colin Law wrote in post #1085864:
But there was only one previous post ... extra clutter wasn't needed.

Ok, I've had a look at the Javscript and it seems ok. But now I've
thought of another scenario:

Up until now, I have had to request the user click on a hyperlink to
navigate to the next page. But say the user inputs data to a form. Is it
possible, once the data has been submitted (by clicking the "send"
button), that this event can trigger automatic navigation to the next
page?

Colin Law

unread,
Nov 22, 2012, 5:56:04 AM11/22/12
to rubyonra...@googlegroups.com
On 22 November 2012 10:48, Joz Private <li...@ruby-forum.com> wrote:
> Colin Law wrote in post #1085864:
>> On 22 November 2012 09:46, Joz Private <li...@ruby-forum.com> wrote:
>>
>> Please quote the previous message so that it is easier to follow the
>> thread. The only way anyone reading this will know what you are
>> talking about is by looking back at the earlier email.
>>
>>> Is there a way to do this without Javascript?
>>
>> Not as far as I am aware.
>>
>>>
>>> I haven't used it before. For my Rails stuff at the moment (I'm just
>>> learning it) I want to stick to mainly Ruby and HTML, as that's all I
>>> really know at this stage ...
>>
>> In that case you will have to stick to basic features until you can
>> get round to learning about javascript - which is essential for
>> anything other than a basic site. You will also need CSS knowledge.
>>
>> Colin
>
> But there was only one previous post ... extra clutter wasn't needed.

I still had to look back at the previous message to remind myself what
the question was about. Also remember these posts are archived and
will be found by users searching for information. In that case it may
not be trivial to see the previous post, and a message that says just
"Is there a way to do this without Javascript?"

>
> Ok, I've had a look at the Javscript and it seems ok. But now I've
> thought of another scenario:
>
> Up until now, I have had to request the user click on a hyperlink to
> navigate to the next page. But say the user inputs data to a form. Is it
> possible, once the data has been submitted (by clicking the "send"
> button), that this event can trigger automatic navigation to the next
> page?

I don't understand the question. Once the user has submitted the form
it is entirely under your control (in the controller action) which
page appears next, so you can make it navigate wherever you like.

Colin

rahul kumar

unread,
Sep 1, 2014, 3:31:00 AM9/1/14
to rubyonra...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages