views:

44

answers:

0

I have this, and it works but it's pretty obtrusive.

I am essentially mimicking tabs where each one holds one step in a 5 step process. If the previous step has been completed then I want the tab text to be a link, otherwise just text without a link.

So the first step might be to select a service, which sets the service_id. If the service_id is not empty, then the second tab (code shown below) should be a link, otherwise just text, b/c I don't want you to be able to proceed until you've selected a service.

Is there a better way?

=link_to_unless 'javascript:service_id.val() == ""', 'Staff', 'javascript:goToTab("staff")'

Additionally, is there a way to toggle that? In other words, if it starts off as not a link, can I programmatically make it become a link?