D
DGibson
The behavior of my InfoPath form should be impossible, but it's happening.
There's something that I'm missing that's keeping this from working right.
Background:
There is a Status field in my form that I use to keep track of what step of
a process the form is in. When the form is first opened, this Status field
is given a default value of "New". Then as certain steps are taken, the
Status is updated to different values. Each step of the process has the form
saved to a different Sharepoint document library to await the next step. The
save portion of the form code works fine, but I need to also delete the form
from the old document library.
In my save function, I do a test of the status field to see if it's a new
form to see if there is an old form to delete. The code for this is:
XDocument.UI.Alert("oldDocLib: " + oldDocLib);
if (oldDocLib = "New")
{
XDocument.UI.Alert("New document. No delete needed.");
}
else
{
XDocument.UI.Alert("Deleting from " + oldDocLib);
}
When I first open the form and submit it, it displays the alert "oldDocLib:
New" and then I get another alert "New document. No delete needed." That's
expected and everything is fine there.
I close Infopath and go to the new document library where the form has been
saved to and open it. I take the next step and submit it (which uses a
different submit button and function that calls the same above save
function). This time, I get an alert "oldDocLib: Review" and then the next
alert is "New document. No delete needed."
This is where I'm confused. The IF statement is based on a variable that
I'm alerting off of just before and the variable is obviously not "New", but
no matter what happens, the IF statement is *always* testing true for some
reason.
Can anyone even take a shot in the dark on this one?
There's something that I'm missing that's keeping this from working right.
Background:
There is a Status field in my form that I use to keep track of what step of
a process the form is in. When the form is first opened, this Status field
is given a default value of "New". Then as certain steps are taken, the
Status is updated to different values. Each step of the process has the form
saved to a different Sharepoint document library to await the next step. The
save portion of the form code works fine, but I need to also delete the form
from the old document library.
In my save function, I do a test of the status field to see if it's a new
form to see if there is an old form to delete. The code for this is:
XDocument.UI.Alert("oldDocLib: " + oldDocLib);
if (oldDocLib = "New")
{
XDocument.UI.Alert("New document. No delete needed.");
}
else
{
XDocument.UI.Alert("Deleting from " + oldDocLib);
}
When I first open the form and submit it, it displays the alert "oldDocLib:
New" and then I get another alert "New document. No delete needed." That's
expected and everything is fine there.
I close Infopath and go to the new document library where the form has been
saved to and open it. I take the next step and submit it (which uses a
different submit button and function that calls the same above save
function). This time, I get an alert "oldDocLib: Review" and then the next
alert is "New document. No delete needed."
This is where I'm confused. The IF statement is based on a variable that
I'm alerting off of just before and the variable is obviously not "New", but
no matter what happens, the IF statement is *always* testing true for some
reason.
Can anyone even take a shot in the dark on this one?