Limit amount of repeating table rows that can be created - InfoPath Dev
in

InfoPath Dev

Limit amount of repeating table rows that can be created

Last post 02-08-2017 05:30 AM by Stuart Shutts. 17 replies.
Page 1 of 2 (18 items) 1 2 Next >
Sort Posts: Previous Next
  • 09-19-2008 07:31 AM

    • jrudolph
    • Top 150 Contributor
      Male
    • Joined on 07-02-2008
    • Orlando, FL
    • Posts 67

    Limit amount of repeating table rows that can be created

    I have a table that I want the maximum number of rows that can be entered by the user to be 4. Is there a way to do this with out programming?

    I have tried using rules, but that doesnt seem to be an option.

    Filed under:
  • 09-19-2008 10:40 AM In reply to

    Re: Limit amount of repeating table rows that can be created

    Rather choosing Rules, you can go with conditional formatting on Repeating Table.

    Take a counter,which can count the no of rows in that repeating table and apply the conditional formatting to Repeating table saying,

    if the counter = 4 the condition is "dont allow the user to insert and delete the row".

    Fine, I will tell you the problem(in above case), if the user add 4 rows, it wont allow to insert new row and at the same time it wont allow to delete the row also.If this is fine you can go with this approach, otherwise

    the only solution in that case is the programming.

    If you go with programming, I can tell you the approach how to proceed further.

    Thanks & Regards,
    Srikrushna Patro.
  • 09-19-2008 11:08 AM In reply to

    Re: Limit amount of repeating table rows that can be created

    You can also modify the schema of the form to limit the number of rows that can be inserted.

    Save your form as source files. Open the schema with a text editor (if you created it yourself, starting with a blank form in IP, it will be named myschema.xsd) and find the element bound to your repeating table. You'll see the 'maxOccurs' is set to unbounded. Change that to 4.

    Your user will get an unattractive message with this approach if they try to exceed the limit, but they will be able to add and delete sections.

    Hilary Stoupa

  • 09-19-2008 11:16 AM In reply to

    • jrudolph
    • Top 150 Contributor
      Male
    • Joined on 07-02-2008
    • Orlando, FL
    • Posts 67

    Re: Limit amount of repeating table rows that can be created

    Thanks Hilary, that works great. Do you know if there is a way to change they type of message that appears?

  • 09-19-2008 11:22 AM In reply to

    • jrudolph
    • Top 150 Contributor
      Male
    • Joined on 07-02-2008
    • Orlando, FL
    • Posts 67

    Re: Limit amount of repeating table rows that can be created

    I cant seem to find the "counter" control or formating. 

    I am building a web enabled form does that matter?

    Never mind I figured it out, use the "count" function as part of the default settings.

  • 09-19-2008 12:30 PM In reply to

    Re: Limit amount of repeating table rows that can be created

    I'm sorry, I don't know of a way to change the message. It is ugly, isn't it! I imagine there is a way in code....

    Hilary Stoupa

  • 09-19-2008 12:32 PM In reply to

    • jrudolph
    • Top 150 Contributor
      Male
    • Joined on 07-02-2008
    • Orlando, FL
    • Posts 67

    Re: Limit amount of repeating table rows that can be created

    okay well thanks anyways. I like this method, and it is probably going to be rare that the message pops up anyways.

  • 10-31-2008 10:33 AM In reply to

    Re: Limit amount of repeating table rows that can be created

    Hi Hilary, I am attempting to do the same thing on a form I have designed.  I've exported the source files and opened myschema.xsd in notepad so I can set  the "maxOccurs" however when I try to save or exit the schema I get an error message saying it cannot create file and to check the file name and path are valid....any ideas?

  • 10-31-2008 11:37 AM In reply to

    Re: Limit amount of repeating table rows that can be created

    After you saved as source files, did you close your form? If the form is still open, it is 'using' those form files, like the schema, so they will open read only....

    Hilary Stoupa

  • 11-05-2008 05:07 AM In reply to

    Re: Limit amount of repeating table rows that can be created

    Hmmm, think I must be doing something wrong here.  I'm using IP 2003 and don't have any options to "Save" my form as source file - only the option to export the source files.  I can do that and then alter the schema but it doesn't change the way the form works - presumably they're no longer "joined" after I export the source files?

    Hate to be a pain but it would make my life easier if I could sort this out :)

  • 11-05-2008 07:21 AM In reply to

    Re: Limit amount of repeating table rows that can be created

    You aren't a pain at all! Export the source files. Close the form. Change the schema file in the folder with your source files. Open manifest.xsf in your source files in design mode, and 'Save As' a  new .xsn to basically 'repack' those source files up in a template..... make sense?

    Hilary Stoupa

  • 11-05-2008 08:43 AM In reply to

    Re: Limit amount of repeating table rows that can be created

    Genius - it works!  Thanks so much again.

    As you've been such a great help, maybe you could look at another query I've posted on here - I've had some help from another person in the forum but they were working on IP2007 so I've come up stuck again.  Again, it's not a life or death thing but something that would really improve the functionality of my form.

    http://www.infopathdev.com/forums/p/9483/33748.aspx#33748

    Cheers!

  • 05-11-2009 08:38 AM In reply to

    Re: Limit amount of repeating table rows that can be created

    Hi Hilary,

     

    I was searching for information about the limit of repeating sessions and i found this forum, it looks you're an expert on the subject. What i need to know is the opposite of the above. Do you know the standard limit of rows for repeating sessions, i mean, if we don't impose a limit, does Infopath have "standard" limit of rows that can be inserted?

     Thank you very much

    Elsa  

  • 05-11-2009 08:55 AM In reply to

    Re: Limit amount of repeating table rows that can be created

    Hi, Elsa -- welcome to the forum.

    As far as I know, there is no upper limit. The schema for the repeating group says that the max is 'unbounded', which means.... no upper limit. Keep in mind that as your xml file increases in size (which will happen as new groups are inserted) you may eventually see some performance issues for that xml file.

    Hilary Stoupa

  • 08-15-2013 12:13 PM In reply to

    Re: Limit amount of repeating table rows that can be created

    Hi, I found a way to customize the message you see in the alert box after maxOccurs property is changed in the schema.xsd file. However, this I tested in browser enabled forms only. The OOB message that gets displayed in the alert box comes from a variable "k_strValidationMaxChildCountFormat " in a javascript file called "IntlCoreStrings.Js". This can be overwritten using the below code. Put this code in Form Loading event of form's code behind. The default message is "A new item could not be inserted. In this form only a maximum of {0} items is allowed.". In the below example I replaced it with "Test{0}". string strScript = "IntlCoreStrings.k_strValidationMaxChildCountFormat = \"Test{0}\";"; Page pgCurrent = HttpContext.Current.Handler as Page; if (pgCurrent != null) { ScriptManager.RegisterStartupScript(pgCurrent, pgCurrent.GetType(), "Alert", strScript, true); return; } Make sure you add the references for the System.Web and System.Web.Extentions assemblies in you solution. Also, the using tags for System.Web and System.Web.UI. I know I replied very late. But, this can help others who comes here for a solution :) Thanks, Shiva
Page 1 of 2 (18 items) 1 2 Next >
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.