Hide/Delete a field on Submit - InfoPath Dev
in

InfoPath Dev

Hide/Delete a field on Submit

Last post 01-16-2006 05:14 PM by Matt Faus. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 01-16-2006 03:53 AM

    Hide/Delete a field on Submit


    Hi there,

    I have a form that has a data field that holds sensitive data. This data needs to be input onto the form in order that a printed version can be kept in a manual filing system.

    However I don't want this particulardata field being kept on the form which is saved on sharepoint when submitted.

    Obviously I could just manually delete the text before I hit Save, but is there some code that could make the field lose it's data on Submit? Or alternatively just hide the field so that anyone calling up the form from sharepoint would not be able to view this field?

  • 01-16-2006 09:12 AM In reply to

    Re: Hide/Delete a field on Submit

    On your submit button or onSaveRequest event you could include this code:
    XDocument.DOM.selectSingleNode( "XPath/To/sensitiveNode" ).text = "";

    You could also look into User Roles to determine who is able to see what sections of your form. I hope this helps, I'm not exactly sure of your situation.

    ---------------
    Matt Faus
    InfoPath Dev Texas
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 01-16-2006 01:17 PM In reply to

    Re: Hide/Delete a field on Submit


    Thanks Mfaux for the reply.

    Looking into user roles is getting a bit complicated as I have already hit problems in this area regarding a simple print button. (long story and another thread!).

    OK.. if I use this code, and the field that I want zapping is called 'Data' ... how would the code you just suggested read? (ie: is sensitiveNode the field name?

  • 01-16-2006 01:28 PM In reply to

    Re: Hide/Delete a field on Submit


    What I want to achieve is to have a form where 10 fields are filled in by the user, then printed to a hard copy, but when saved to file (be it a hard drive, a database, sharepoint or wherever) then only 9 of the fields are actually saved as part of the form.

    Obviously I know that I can tell the form to only pass over 9 of the fields into a said database or sharepoint directory but the physical form that is saved onto the system will still show the full form with the ten fields orginally filled in...

    As I said, I know I can manually just delete the text from the field after the forms been printed and Before saving it to disk/database/sharepoint wherever, but this seems a bit unprofessional and manual!

    I actually managed to get it to disapear via conditional formatting but it does it too soon! I need to assign this function to a submit button so it only dissapears or becomes null/hides at the point it is saved



  • 01-16-2006 05:14 PM In reply to

    Re: Hide/Delete a field on Submit

    To create a custom submit button you can put in a plaing button and put the submit code in via Edit Form Code on the button.

    In the custom submit button code you can put whatever needs to happen before submitting and then at the bottom put XDocument.Submit(); to submit the form just like a regular submit button would. You can use the line I mentioned above to delete the text and then hide the field with conditional formatting and a helper node.

    I hope this helps, let us know if you have any more trouble!

    ---------------
    Matt Faus
    InfoPath Dev Texas
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.