« Thomson / Technicolor TWG870 KabelrouterGoogle Apps: Enable a group to be able to write e-mails with the group address »

InfoPath: Unwanted required fields when using XmlWriter to create fields in repeating group

11.10.11

Permalink 23:32:18, von ff E-Mail , 135 Wörter   German (DE) latin1
Kategorien: Computer, Microsoft

InfoPath: Unwanted required fields when using XmlWriter to create fields in repeating group

Having set up fields in a repeating group programmatically using XmlWriter, integer and date fields would have a red star attached, not validating at saving time, although not marked required in the data connections. It helps to add the xsi:nil="true" attribute to the element. Instead of:

writer.WriteElementString("elementName", myNamespace, "");

simply write:

writer.WriteStartElement("elementName", myNamespace);
writer.WriteAttributeString("xsi", "nil", xsiNamespace, "true");
writer.WriteEndElement();

And voila: The fields are not mandatory any more.

I tried to use this bug as a feature, but it only works for integer and date fields, not for text fields. In order to make text fields required programmatically, just add a field in the main data connection as switch and attach the validation rule to it. When the program decides to make the fields required, set the switch.

Noch kein Feedback

Einen Kommentar hinterlassen


Ihre E-Mail-Adresse wird nicht auf dieser Seite angezeigt.

Ihr URL wird angezeigt.
(Zeilenumbrüche werden zu <br />)
(Name, E-Mail-Adresse & Webseite)
(Benutzern erlauben, Sie durch ein Kontaktformular zu kontaktieren (Ihre E-Mail-Adresse wird nicht weitergegeben))
Februar 2012
Mo Di Mi Do Fr Sa So
 << <   > >>
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29        

Suche

powered by b2evolution