disable delete repeating section - InfoPath Dev
in

InfoPath Dev

disable delete repeating section

Last post 09-11-2007 08:55 AM by GLazkano. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 05-03-2006 12:10 AM

    disable delete repeating section

    Hi,

    I have a very complexe situation that I cannot solve.

    here is an example of my structure:
     <AVel F14="0" fldID="123">
    <Title>SHAB-Zitat</Title>
    <Texte>
    <Text>(SHAB Nr. 63 vom 31.03.1999, S. 2111)</Text>
    <choixM/>
    </Texte>
    <Texte>
    <Text>Verein</Text>
    <choixM/>
    </Texte>
    </AVel>

    My Texte is a repeating section and I want to disable the delete possibility if there is only one element of Texte(but the user need to be able to insert another occurence). But if there are multiple Texte I want to be able to delete the other, but one Texte element must stay in the form!

    In the OnbeforeChange Event if I use e.Source or e.Site, I can't select AVel for see if there is one or multiple Texte. Infopath send a null value!

    AVel is multiple too so I cant use thisXDocument because I dont know on which I am. The only way to know is to take the fldID on AVel but If I cant select AVel I can't select fldID too.

    How I can made? There is a way with conditionnal formating it's possible but that disable the insert too. and I dont want this!

    Thanks

    ++

    Thierry
    Infopath 2007, Langage: C#2.0 (Modèle Objet 2003)
    merci de lire ceci
  • 05-04-2006 12:22 AM In reply to

    Re: disable delete repeating section

    Hi Thierry,
    You can set minoccurs as 1 in the schema for "Texte" then you will not be able to delete the last node.
  • 05-04-2006 12:58 AM In reply to

    Re: disable delete repeating section

    Hi and thanks for your reply Agni,

    that's a good idea but that don't seems to work. My schema:

    If I do like you say make my element has non optionnal (minoccurs=1) I can always delete my last Texte in infopath.

    Are you any idea about why? It's because I have an optionnal choice before?

    If it's the case, sometimes I have an AVel with a Title element but with nothing else. So can I do somethings for change my schema and that still work?

    Any Idea?

    Thanks a lot!
    Infopath 2007, Langage: C#2.0 (Modèle Objet 2003)
    merci de lire ceci
  • 05-25-2006 04:40 PM In reply to

    Re: disable delete repeating section

    Another way to achieve this is in code. You would set in the OnBeforeChange event to check if there is only one element at that level and if so cancel the delete. In the datasource task pane go to the node for that repeating section. Then double-click to get the properties. There go to Validation and Event Handlers. From there select the OnBeforeChange event and you will be able to add the code from there.
    Shiraz Cupala / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 09-11-2007 08:17 AM In reply to

    Re: disable delete repeating section

    Rereading this post I wanted to address one other point. The issue you're having indeed may be because of the optional choice before the item. I would try a test with a very simple repeating schema to verify.

    Shiraz Cupala / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 09-11-2007 08:55 AM In reply to

    • GLazkano
    • Top 200 Contributor
      Female
    • Joined on 07-05-2007
    • Basque Country
    • Posts 54

    Re: disable delete repeating section

    Hi!

    I have a similar problem with my project.

    In my form when a user delete a repeating section, a value from that repeating section must be used to add it on a sharepoint field (that's because if the user deletes that, that quantity of the product must be again in the stock).

    Can anybody tell me how to do that? I have no preferences about doing it with the GUI or with code.

     

    Thanks. 

Page 1 of 1 (6 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.