×

Discussion Board

Results 1 to 12 of 12
  1. #1
    Registered User
    Join Date
    Jan 2008
    Location
    Gurgaon, India
    Posts
    27

    How to avoid "Save" command in appuifw.Form (Make "Auto Save" form)

    Hi, I am quite new in PyS60, struggling with one problem in appuifw.Form. I crated a form and put "Ok" command. Now what I want is when I press "Ok", then I can retrieve the information entered by the user in the form. I have noticed that in the form "Save" and "Back" commands are coming by default, and until I press "Save", I cant retrieve information entered by user in the form. I want to avoid pressing "Save". Could you help me in this regard. I am giving here sample code also.

    ###################################################
    Code:
    import appuifw
    
    class MyForm:    
        def show(self):
            fields = [( u'Name', 'text', u''), (u'Password','text', u'')]
            self.form = appuifw.Form(fields, appuifw.FFormEditModeOnly)        
            self.form.flags = appuifw.FFormEditModeOnly
    	self.form.menu = [(u'Ok', self.on_ok)]
            self.form.execute()
     
        def on_ok(self):
    	print 'Name is ', self.form[0][2]
    	print 'Password is ', self.form[0][2] 
     
    if __name__ == "__main__":
        appuifw.app.title = u'Forms with save issue'
        form = MyForm()
        form.show()
    ###################################################
    Last edited by shail229; 2008-06-25 at 06:50.

  2. #2
    Regular Contributor
    Join Date
    Dec 2007
    Location
    Tempe, AZ
    Posts
    411

    Re: How to avoid "Save" command in appuifw.Form (Make "Auto Save" form)

    Hi shail229,
    First of all you can use, square bracket CODE closing bracket, to start from where you want to put code and close it with square bracket /CODE closing bracket. (Ya substitute [ for square bracket and ] for closing bracket}

    Now forms are meant to be saved AFAIK. If you want to just save the information why don't you use appuifw.query() instead?
    IDEAS is all they need but still they think only Genius can give them that.

  3. #3
    Registered User
    Join Date
    Jan 2008
    Location
    Gurgaon, India
    Posts
    27

    Re: How to avoid "Save" command in appuifw.Form (Make "Auto Save" form)

    Hi Shubhendra, thanks for your reply. Actually I can't use appuifw.query() as there are multiple fields (with different types like "text", "date", "number") and I want to display them together. There are few commands also with different actions. Each command action needs inputs provided by the user. So before each command action, I have to press "Save". Is there any way to avoid pressing "Save"?

  4. #4
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: How to avoid "Save" command in appuifw.Form (Make "Auto Save" form)

    Quote Originally Posted by shail229 View Post
    Hi Shubhendra, thanks for your reply. Actually I can't use appuifw.query() as there are multiple fields (with different types like "text", "date", "number") and I want to display them together. There are few commands also with different actions. Each command action needs inputs provided by the user. So before each command action, I have to press "Save". Is there any way to avoid pressing "Save"?
    hi shail229
    if you want to use multiple fields then why dont you use multiple queries hope you are getting that.

  5. #5
    Registered User
    Join Date
    Jan 2008
    Location
    Gurgaon, India
    Posts
    27

    Re: How to avoid "Save" command in appuifw.Form (Make "Auto Save" form)

    Ya that is correct, but as far I know multiple_query can not be used for different types like "text", "number", "date" together. And I can't add commands there. i want to show all the fields together in one screen with some of the commands.

  6. #6
    Regular Contributor
    Join Date
    Dec 2007
    Location
    Tempe, AZ
    Posts
    411

    Re: How to avoid "Save" command in appuifw.Form (Make "Auto Save" form)

    Ok got it what you want, please see the following link for a program, run it, you can see that when "save" button is clicked print occurs, instead of that you can do some function call for your problem statement

    http://lfdm.net/thesis/index.php/200...46-use-of-form

    PS-> thanks to this guy who made a quite commented program.
    IDEAS is all they need but still they think only Genius can give them that.

  7. #7
    Registered User
    Join Date
    Jan 2008
    Location
    Gurgaon, India
    Posts
    27

    Re: How to avoid "Save" command in appuifw.Form (Make "Auto Save" form)

    Thanks, but this is not what I want. This example sets action for "Save". I don't want to put my action on "Save", but I want to call "Save" on my command action. Suppose there is command with label "Submit", so on pressing "Submit" all the inputs of the form-fields should be available to the form. I hope you are getting my point.

  8. #8
    Nokia Developer Moderator
    Join Date
    May 2007
    Location
    21.46 N 72.11 E
    Posts
    3,800

    Re: How to avoid "Save" command in appuifw.Form (Make "Auto Save" form)

    Quote Originally Posted by shail229 View Post
    Thanks, but this is not what I want. This example sets action for "Save". I don't want to put my action on "Save", but I want to call "Save" on my command action. Suppose there is command with label "Submit", so on pressing "Submit" all the inputs of the form-fields should be available to the form. I hope you are getting my point.
    Hi shail229,

    I have replied to your email on the PyS60 Google Group.

    Best Regards,
    Croozeus
    Pankaj Nathani
    www.croozeus.com

  9. #9
    Registered User
    Join Date
    Jan 2008
    Location
    Gurgaon, India
    Posts
    27

    Re: How to avoid "Save" command in appuifw.Form (Make "Auto Save" form)

    Hi Pankaj,
    I have seen your answer in Google Group. Is there any better approach to do that?
    When user is pressing "Save" then some procedure is being called to save the form and invokes save_hook. Can I not have the handle of that procedure, which saves the form (without pressing "Save" or using keypress).

  10. #10
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: How to avoid "Save" command in appuifw.Form (Make "Auto Save" form)

    Quote Originally Posted by shail229 View Post
    Thanks, but this is not what I want. This example sets action for "Save". I don't want to put my action on "Save", but I want to call "Save" on my command action. Suppose there is command with label "Submit", so on pressing "Submit" all the inputs of the form-fields should be available to the form. I hope you are getting my point.
    hi shail229
    i think i got your question shail229 let me explain it to you that instead of printing the inputs of form you wnt to save that in another form hope i am right well you can still do that by just calling another function when pressing that label your function should be capable enough to save that to another form hope i m right.
    witing for ur feedback

  11. #11
    Registered User
    Join Date
    Jan 2008
    Location
    Gurgaon, India
    Posts
    27

    Re: How to avoid "Save" command in appuifw.Form (Make "Auto Save" form)

    Hi Gaba88,
    Actually in my application there is login form with fields "user name" and "password". This form has one command "Login". Now what I want is that when user enters user name and password information in the login form and press "Login" command, then those login details will be used to authenticate the user.

    But here the problem is that user has to press "Save" before pressing "Login" then only user's input (login details) can be saved in the form and can be available to the program for any action. Is there any way to avoid pressing "Save"? I mean user will enter some inputs in the login form then press "Login" (without pressing "Save") and action of "Login" can read those form details to take some action accordingly.

    Code:
    import appuifw
    
    login_details = {}
    login_details['abcd'] = 'efgh'
    login_details['aa'] = 'xx'
    
    class MyForm:    
        def show(self):
            fields = [( u'User Name', 'text', u''), (u'Password','text', u'')]
            self.form = appuifw.Form(fields, appuifw.FFormEditModeOnly)        
            self.form.flags = appuifw.FFormEditModeOnly
    	self.form.menu = [(u'Login', self.on_login)]
            self.form.execute()
     
        def on_login(self):
    	user_name = str(self.form[0][2])
    	passwd = str(self.form[1][2])
    	if not user_name:
    	    appuifw.note(u'User name is missing', 'error')
    	    return
    	if not passwd:
    	    appuifw.note(u'Password is missing', 'error')
    	    return
    	print "user name is ", user_name
    	print "password is ", passwd
    	success = False
    	if login_details.has_key(user_name):
    	    if passwd == login_details[user_name]:	        
    		success = True
    	
    	if success:
    	    appuifw.note(u'Login success', 'info')
    	    ## Do some action accordingly##
    	else:
    	    appuifw.note(u'Invalid user name and/or password', 'error')
    	    ## Be in the same form ##
    	    return
    		
     
    if __name__ == "__main__":
        appuifw.app.title = u'Forms with save issue'
        form = MyForm()
        form.show()

  12. #12
    Registered User
    Join Date
    Jan 2008
    Location
    Gurgaon, India
    Posts
    27

    Re: How to avoid "Save" command in appuifw.Form (Make "Auto Save" form)

    Continued..

    If you run the given code, you will see login form and fields "User name" and "Password". Now user has entered some values say "aa" and "bb" and then user pressed "Login" ("Options">"Login"). Immediately user gets the error message that "User name is missing", because user has not pressed "Save" ("Options">"Save") command. But if user will press "Save" command then press "Login" in that case its fine. But I want to avoid pressing of "Save" command.

Similar Threads

  1. Problem in build with S60 1FP
    By Manuelito_ in forum Symbian Tools & SDKs
    Replies: 14
    Last Post: 2007-09-18, 12:08
  2. How to make a form go away again?
    By Dankoozy in forum Symbian
    Replies: 1
    Last Post: 2007-06-18, 09:43
  3. errors when building?
    By neilxp in forum Symbian Tools & SDKs
    Replies: 5
    Last Post: 2007-04-18, 14:10
  4. [Pys60, 3rd Ed.] build problems
    By MHOOO in forum Symbian
    Replies: 3
    Last Post: 2007-04-09, 19:00
  5. abld make files missing
    By dalore in forum Symbian
    Replies: 0
    Last Post: 2003-06-13, 12:40

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×