Editing Form fields with C#

J

Jaco Leuschner

Hi

I am trying to set the value of a field in the OnSaveRequest event, but the
field's value does not change. Can anyone help me?

I have added the code below.

[InfoPathEventHandler(EventType=InfoPathEventType.OnSaveRequest)]
public void OnSaveRequest(SaveEvent e)
{
string ErrorAttribute = thisXDocument.DOM.selectSingleNode
("/ns1:SingleApplicationForm/System/ErrorsRemainYN").text;
int ErrorsLeft = thisXDocument.Errors.Count;
if(ErrorsLeft > 0)
{
ErrorAttribute = "yes";
}
else
{
ErrorAttribute = "no";
}

e.IsCancelled = e.PerformSaveOperation();
e.ReturnStatus = true;
thisXDocument.SetDirty(false);
}
 
F

Franck Dauché

Hi,

Try to make "System/ErrorsRemainYN" fully qualified: prefix + name
Right now, your selectSingleNode probably points nowhere...

Franck
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top