facebook

Help with javascript code

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 15 posts - 16 through 30 (of 38 total)
  • Author
    Posts
  • #348401

    Henzalah
    Member

    actully it is the same one i dont have any DB for example i want to put a user name and password for each Apartment (apartment1.mobi) will be linked to a user name and password
    (apartment2.mobi) will be linked to a user name and password

    so the login UI (ID and password ) will link me to the prefered Apartment

    #348402

    Code_A
    Member

    Are you planning to hardcode usernames and passwords before you distribute the app??? If that is your plan then you could just link everything together using arrays.

    var users=new Array("user1","user2","user3");
    var pass=new Array("pass1","pass2","pass3");
    
    var aptNum = $('#m1-cosy-textField1').val();
    var username= $('#m1-cosy-textField2').val();
    var password= $('#m1-cosy-textField3').val();
    
    if (users[aptNum -1] == username && pass [aptNum -1] == password){
      //pass
      phoneui.gotoScreen('m1-apartment' + aptNum);
    }else{
      //fail
    }
    

    I am not sure I completely understand what you are trying to here with the usernames.

    Out of curiosity, is the information that you are going to be displaying on the apartment screens static or dynamic? I am trying to get a feel for your app purpose and functionality.

    #348403

    Henzalah
    Member

    in the welcome screen i have 2 buttons (staff-guest)

    what i want to do is:
    when i press on the guest button it will ask me directly for a user name and password or password at least and this will takes me directly to the appartment.mobi

    what do u think maybe u have a better idea which will save alot of effort and time!!!

    if it is possible to be directed without a Login UI i dont mind even, i created the login UI but if it will make me suffer i prefer not to use it.

    #348404

    Code_A
    Member

    How are you going to manage the usernames and passwords? Do you want the users change their usernames and passwords, or are you going to want to change the usernames and passwords after you distribute the app? Do you want users to be able to log in using different devices? Typically usernames and passwords are setup on web server that the app connects to so that the info is not specific to a device.

    Here is a How-To on a Login Scenario.

    #348405

    Henzalah
    Member

    i will provide the guests with the user name and the password
    each guest will be using this for a short duration and after he leave i will modify passwords and the user names again so that he cannot log in again when he is not using the apartment.

    the app user must not change anything (user ID – password) he will only read info i supply.
    and it will be installed on one device.

    and for the login scenario i already read it but to be honest it doesn’t help me that much.

    #348406

    Code_A
    Member

    Ok, so how are you planning to modify the content that you supply the guests? Are you supplying the devices or will the guests be installing the app on their own devices?

    I guess, either way I would recommend storing this information in a database on a server with php interface between the DB and your app. This will make your life a lot easier when you need to update the content.

    #348407

    Henzalah
    Member

    as what i understood from ur words that it is kind of impossible to modify the content of the app after publishing is this true ??
    i am forced to do it the hard way since they don’t have any database or servers…
    and regarding the devices they will be using there own devices.

    so what do u suggest?

    #348408

    Code_A
    Member

    If you do not have access to a web server then you are pretty much limited to storing everything locally and providing new content through app updates, which is a very inefficient and an extremely undesirable method. Ideally, you need a web service to do what you are trying to do.

    #348409

    Henzalah
    Member

    for now i can do nothing except going ahead of this project since i hate to leave not finished stuff..

    regarding this code where i should implement it in which page can u guide me plzz !!!

    var users=new Array(“user1″,”user2″,”user3”);
    var pass=new Array(“pass1″,”pass2″,”pass3”);

    var aptNum = $(‘#m1-cosy-textField1’).val();
    var username= $(‘#m1-cosy-textField2’).val();
    var password= $(‘#m1-cosy-textField3’).val();

    if (users[aptNum -1] == username && pass [aptNum -1] == password){
    //pass
    phoneui.gotoScreen(‘m1-Apartment’ + aptNum);
    }else{
    //fail
    }

    and regarding updating the data later one i have to do it manual at least till they have servers and DB

    #348410

    Code_A
    Member

    You would place the code behind the button that the user clicks to login and go to the screen. Basically, you wold take the current gotoScreen code you have behind the OnChange event of textField1, put 2 more textfields on the screen (username and password) and a button, then when the user clicks the button it checks the three fields and does its thing.

    #348411

    Henzalah
    Member

    so i should create 3 textfield

    the 1st one is for apartment
    the 2nd one is user name
    the 3rd one is for password
    and a button (log-in)

    this is what i understood and the code is under the log-in button.

    but for the three textfields no codes required

    can u please clear this for me

    #348413

    Code_A
    Member

    That is correct. However, you will want to use a password field instead of a textfield for the password.

    #348415

    Henzalah
    Member

    it didnt work and shall i add additional project files (apartment1.mobi,……)

    Attachments:
    You must be logged in to view attached files.
    #348416

    Code_A
    Member

    Are you typing in User1 and Pass1 in the fields and an apt number? Yes, you need to add the apartment files to the project. Can you post your files?

    #348417

    Henzalah
    Member

    yes i am and which files do u need exactly ??

Viewing 15 posts - 16 through 30 (of 38 total)
Reply To: Help with javascript code

You must be logged in to post in the forum log in