How do I have different views

I would like to be able to launch a different view after my login screen and collapse or get rid of the login view. How would I do this?

There are a lot of ways to do this in Fuse. Here is one to get you started.

      var Observable = require('FuseJS/Observable');
      var LoginVisible = Observable('Visible');
      function login() {
          LoginVisible.value = 'Collapsed';
      module.exports {
          login: login,
        LoginVisible: LoginVisible
      <LoginView Visibility="{LoginVisible}" />

Okay thankyou very much! When LoginView is Visible would it lay over the top of AppView or would I need to change AppView’s visibility to collapsed?

Higher “up” in the UX-document = higher “up” in the layer stack. Like layers in Photoshop.

So move the LoginView one line above AppView to acheive that.

Okay got it, thankyou all!

I can get the view to collapse, but my other view doesn’t appear.


<App Theme="Basic">
    <iOS.StatusBarConfig Style="Light" />
    <JavaScript File="Main.js" />
        <HomeView Visibility="{HomeVisibility}" />
        <LoginView Visibility="{LoginVisibility}"/>


// main observable
var Observable = require("FuseJS/Observable");

//the observables to hold the visibility of different views
var LoginVisibility = Observable("Visible");
var HomeVisibility = Observable("Collapsed");

// Observables for holding the user's email and password
var email = Observable("");
var password = Observable("");

// Observable function to check if correct values have been entered
var areCredentialsValid = Observable(function() {
    return email.value != "" && password.value != "";

// the Login function that sends details to server and check, and returns a value
function Login() {

    //the httprequest object
    var hr = new XMLHttpRequest();

    //variables to pass to the object
    var url = "";
    var params = "email="+email.value+"&password="+password.value;"POST", url, true);

    //set content type to tell server that parameters are in the url
    hr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

    //use onreadystatechange event of the request object
    hr.onreadystatechange = function() {
        if(hr.readyState == 4 && hr.status == 200){
            var return_data = hr.responseText;
            email.value = return_data;
            if(return_data == "Success"){
                LoginVisibility.value = "Collapsed";
                HomeVisibility.value = "Visible";
    //send the data to the server and wait for the response
    email.value = "Attempting login...";


//export the js to be used in the ux files
module.exports = {
    password: password,
    areCredentialsValid: areCredentialsValid,
    Login: Login,
    LoginVisibility: LoginVisibility,
    HomeVisibility: HomeVisibility


<DockPanel ux:Class="LoginView">
        <JavaScript File="Main.js" />
    <!-- login view style style -->
        <Text TextColor="#ffffff" />
        <TextInput PlaceholderColor="#ffffff80" TextColor="#ffffff" CaretColor="#ffffff" />

    <!-- Button colors -->
    <float4 ux:Key="C600" ux:Value="#8869e5" />
    <float4 ux:Key="C700" ux:Value="#6447b3" />
    <float4 ux:Key="CFillFore" ux:Value="#644793" />

    <StatusBarBackground Dock="Top" />
    <BottomBarBackground Dock="Bottom" />

    <!-- <JavaScript File="LoginScript.js" /> -->

    <Video Layer="Background" Volume="0.0" File="Assets/video.mp4" IsLooping="true" AutoPlay="true" StretchMode="UniformToFill" ContentAlignment="CenterRight" Opacity="0.3" Padding="0">
        <Blur Radius="3.31" />

    <Grid Rows="1*,1*">
        <StackPanel Alignment="VerticalCenter">
            <Image File="Assets/logo.jpg" StretchMode="PointPrecise" />
            <Text Alignment="HorizontalCenter" FontSize="50">SSMXC</Text>
            <Text Alignment="HorizontalCenter" FontSize="46">Booking In</Text>
            <Text Alignment="HorizontalCenter" Opacity=".5">book into the next event fast and easy</Text>
        <StackPanel Alignment="VerticalCenter" Margin="50,0,50,0">
            <TextInput PlaceholderText="email" Value="{email}" />
            <TextInput PlaceholderText="password" IsPassword="true" Value="{password}" />
            <Button Text="Log in" IsEnabled="{areCredentialsValid}" Clicked="{Login}"/>


<DockPanel ux:Class="HomeView">
    <JavaScript File="Main.js" />
        <Button ux:InheritStyle="false" ClipToBounds="False"
            Margin="0,0,0,4" Background="#bdc3c7" Name="self">
            <Fuse.BasicTheme.ButtonText TextColor="#FFF" Font="RobotoMedium" Value="{Property self.Text}"
    <StackPanel Dock="Top" Background="#bdc3c7">
        <StatusBarBackground />
        <iOS.StatusBarConfig Style="Light"/>
        <MultiLayoutPanel Height="50" ux:Name="tabBar">
            <GridLayout ColumnCount="3" Rows="1*"/>
            <Panel ux:Name="page1Tab">
                    <Rectangle ux:Name="indicator" Alignment="Bottom" Height="4" Fill="#6c7a89">
                            <Move RelativeTo="LayoutChange" X="1" Duration="0.4" Easing="BackIn"/>
                <Button Text="Page 1">
                        <Set navigation.Active="page1" />
            <Panel ux:Name="page2Tab">
                <Placeholder  Target="indicator"/>
                <Button Text="Page 2">
                        <Set navigation.Active="page2" />
            <Panel ux:Name="page3Tab">
                <Placeholder Target="indicator"/>
                <Button Text="Page 3">
                        <Set navigation.Active="page3" />

    <PageControl ux:Name="navigation">
        <Text ux:Class="WelcomeText" FontSize="30" Alignment="Center"/>
        <Page ux:Name="page1" Background="#eee">
            <WhileActive Threshold="0.5">
                <Change tabBar.LayoutElement="page1Tab" />
            <WelcomeText>Welcome to Page 1</WelcomeText>
        <Page ux:Name="page2" Background="#abb7b7">
            <WhileActive Threshold="0.5">
                <Change tabBar.LayoutElement="page2Tab" />
            <WelcomeText>Welcome to Page 2</WelcomeText>
        <Page ux:Name="page3" Background="#f2f1ef">
            <WhileActive Threshold="0.5">
                <Change tabBar.LayoutElement="page3Tab" />
            <WelcomeText>Welcome to Page 3</WelcomeText>

I have sorted it now, thanks all.

Casey Williams wrote:

I have sorted it now, thanks all.

please advise why Home view doesn’t appear?

please advise why Home view doesn’t appear?

Can you provide some more information about the problem you’re seeing? This thread is quite old so it might not be related to any issues you’re running into now. :slight_smile: