How to write code for checking forms postback and Auto Increment? - InfoPath Dev
in

InfoPath Dev

How to write code for checking forms postback and Auto Increment?

Last post 05-26-2009 11:40 PM by Patrick Halstead. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 05-24-2009 12:30 AM

    How to write code for checking forms postback and Auto Increment?

     Hi,

    I have to do following tasks. Please guide me how to do it.

    1. I have to check on form load that if its loading for first time a button btn1 should not appear on the form else on 2nd time onwards that btn1 should be visible.

    2. There is a text box. i have to make the value in that autoincrement. title of that textbox is Version. and format of increment is 1.1, 1.2 and so on. it will be done every time a user clicks on new.

    Quick reply would be appreciated.

    Thanks

    Sumeet Gandhi

  • 05-24-2009 01:24 AM In reply to

    how to work on Form load and the Auto Increment Number?

     Hi,

    I have to do following tasks. Please guide me how to do it.

    1. I have to check on form load that if its loading for first time a button btn1 should not appear on the form else on 2nd time onwards that btn1 should be visible.

    2. There is a text box. i have to make the value in that autoincrement. title of that textbox is Version. and format of increment is 1.1, 1.2 and so on. it will be done every time a user clicks on new.

    Quick reply would be appreciated.

    Thanks

    Sumeet Gandhi
  • 05-24-2009 02:32 AM In reply to

    • firouz
    • Top 500 Contributor
      Female
    • Joined on 02-24-2009
    • Iran
    • Posts 51

    Re: how to work on Form load and the Auto Increment Number?

    Hi

    1.You can define a flag for your form. it is 1 by default. Then set a coditional formatting in the display setting for the btn1. the condition is : if flag is not equal to1 hide this button.

    You should set a rule when you want to save or submit the form, to turn the flag back to its first value. I dont know how you want to close your form, if you are using a button to save, submit and close form, before all of this action define an action set this field values : set flag= 0 ). In this way the second time that form will be opend flag is not 1 so the btn1 is visible.

    Ofcourse there are another ways... maybe you can use open and save rules, or role base views... but for all of them you need a flag to identify the state of your form.

    2. I have a practical solution using SharePoint list. if you are using SharePoint Tell me To describe the solution.

    hope to be useful for you dear friend!

    Filed under:
  • 05-24-2009 03:38 AM In reply to

    Re: how to work on Form load and the Auto Increment Number?

    firouz:

    Hi

    1.You can define a flag for your form. it is 1 by default. Then set a coditional formatting in the display setting for the btn1. the condition is : if flag is not equal to1 hide this button.

    You should set a rule when you want to save or submit the form, to turn the flag back to its first value. I dont know how you want to close your form, if you are using a button to save, submit and close form, before all of this action define an action set this field values : set flag= 0 ). In this way the second time that form will be opend flag is not 1 so the btn1 is visible.

    Ofcourse there are another ways... maybe you can use open and save rules, or role base views... but for all of them you need a flag to identify the state of your form.

    2. I have a practical solution using SharePoint list. if you are using SharePoint Tell me To describe the solution.

    hope to be useful for you dear friend!

     Hello Firouz,

     Nice to see your reply. See for my query with autogenerate number scenario is like this.

    1. I have created an infopath 2007 form and hosted that in MOSS.

    2. In that form i have a field named "Version" and its having a control " textbox".

    3.  So what the requirement says is that. When I click on "New Form" the above text box should be filled with 1.1 . I complete my other details and click submit. Now again i click on "New Form". So this time the "Version" field should be automatically filled with number 1.2 and so on. after 1.9 it should be 2.0.

    I hope i made the things clear. Looking forward to hear from you soon.

    Many Thanks in advance '

    Sumeet Gandhi

  • 05-26-2009 11:40 PM In reply to

    Re: How to write code for checking forms postback and Auto Increment?

    1. Define two User Roles (Tools->User Roles) and make one Initiator and the other Default. Add a conditional display rule for the button that checks the user role and hides the form if it is not Initiator.
    2. What's the textbox value based on? Is it based on a value in the form or a DB? Probably easiest just to have a hidden field that is a decimal value and add a rule that adds to it when you click new. Is New a button on your form?

     

    Patrick Halstead
    Project Manager at Qdabra
Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.