Identifying name of document

J

Jackie

Can anyone help?

I have an InfoPath form that has a submit button. The submit button sends
the form to an email address. When a user clicks on the form via the email, I
would like them to see a different view (this view is already within the
form).

I have been looking at the OnLoad Event, which I have placed code that
changes the view (so this bit works !!). What I need is to identify the form
via an If statement, which would wrap around the switching view line, but am
having problems as I use VBA/VB.Net so am unfamiliar with the object module.

Many thanks
 
G

GaryU

Actually, I'm interested in this as well, I have similar problems. Can
anyone help here?

Thanks,
Gary
 
R

Russ

I don't know if this is what you are looking for (or if it would work), but
you could try including a hidden "emailed" field in your form somewhere, and
set it to true when the form is emailed. Then you can put a check in your
onLoad event to see if the "emailed" field is true, and set the view
accordingly.
 
J

Jackie

Thanks for the suggestion Russ. Have put this in place, forcing the user to
click on a checkbox, but I still seem to be having problems. The code is
below:

var strValue
strValue = XDocument.DOM.selectSingleNode"//my:Change/my:ChangeSubmit").text

XDocument.UI.Alert(strValue)

if (strValue.text = "false")
XDocument.ViewInfos("Main View").IsDefault = true;

if (strValue.text = "true")
XDocument.ViewInfos("TUG View").IsDefault = true;

The value (strValue) is correct and is giving me a true or false text value
via the alert. The problem I am having is that the "If" statement is not
recognising the value.

Any suggestions greatly appreciated.

Many thanks
Jackie

Russ said:
I don't know if this is what you are looking for (or if it would work), but
you could try including a hidden "emailed" field in your form somewhere, and
set it to true when the form is emailed. Then you can put a check in your
onLoad event to see if the "emailed" field is true, and set the view
accordingly.

Maui Williams said:
I wouldn't know how to do this unless I knew the name of the form before
I submitted the form to the email.

Maui Williams | Solution Developer II, MCSD.Net
Avanade | West Region
2211 Elliott Avenue, Suite 200 Seattle, WA 98121

-----Original Message-----
From: Jackie [mailto:[email protected]]
Posted At: Wednesday, November 01, 2006 8:42 AM
Posted To: microsoft.public.infopath
Conversation: Identifying name of document
Subject: Identifying name of document

Can anyone help?

I have an InfoPath form that has a submit button. The submit button
sends
the form to an email address. When a user clicks on the form via the
email, I
would like them to see a different view (this view is already within the

form).

I have been looking at the OnLoad Event, which I have placed code that
changes the view (so this bit works !!). What I need is to identify the
form
via an If statement, which would wrap around the switching view line,
but am
having problems as I use VBA/VB.Net so am unfamiliar with the object
module.

Many thanks
 
R

Russ

It looks like your problem is that you are referring to the strValue variable
as if it were storing a node. Since you have the line:

strValue = XDocument.DOM.selectSingleNode"//my:Change/my:ChangeSubmit").text

strValue is storing a string, so you don't need to access it with
strValue.text
A simple
if (strValue == "false") { code } else { more code }
would work fine.
(make sure to use == for comparison)

Jackie said:
Thanks for the suggestion Russ. Have put this in place, forcing the user to
click on a checkbox, but I still seem to be having problems. The code is
below:

var strValue
strValue = XDocument.DOM.selectSingleNode"//my:Change/my:ChangeSubmit").text

XDocument.UI.Alert(strValue)

if (strValue.text = "false")
XDocument.ViewInfos("Main View").IsDefault = true;

if (strValue.text = "true")
XDocument.ViewInfos("TUG View").IsDefault = true;

The value (strValue) is correct and is giving me a true or false text value
via the alert. The problem I am having is that the "If" statement is not
recognising the value.

Any suggestions greatly appreciated.

Many thanks
Jackie

Russ said:
I don't know if this is what you are looking for (or if it would work), but
you could try including a hidden "emailed" field in your form somewhere, and
set it to true when the form is emailed. Then you can put a check in your
onLoad event to see if the "emailed" field is true, and set the view
accordingly.

Maui Williams said:
I wouldn't know how to do this unless I knew the name of the form before
I submitted the form to the email.

Maui Williams | Solution Developer II, MCSD.Net
Avanade | West Region
2211 Elliott Avenue, Suite 200 Seattle, WA 98121

-----Original Message-----
From: Jackie [mailto:[email protected]]
Posted At: Wednesday, November 01, 2006 8:42 AM
Posted To: microsoft.public.infopath
Conversation: Identifying name of document
Subject: Identifying name of document

Can anyone help?

I have an InfoPath form that has a submit button. The submit button
sends
the form to an email address. When a user clicks on the form via the
email, I
would like them to see a different view (this view is already within the

form).

I have been looking at the OnLoad Event, which I have placed code that
changes the view (so this bit works !!). What I need is to identify the
form
via an If statement, which would wrap around the switching view line,
but am
having problems as I use VBA/VB.Net so am unfamiliar with the object
module.

Many thanks
 
J

Jackie

Many thanks Russ ... it works like a charm.

Russ said:
It looks like your problem is that you are referring to the strValue variable
as if it were storing a node. Since you have the line:

strValue = XDocument.DOM.selectSingleNode"//my:Change/my:ChangeSubmit").text

strValue is storing a string, so you don't need to access it with
strValue.text
A simple
if (strValue == "false") { code } else { more code }
would work fine.
(make sure to use == for comparison)

Jackie said:
Thanks for the suggestion Russ. Have put this in place, forcing the user to
click on a checkbox, but I still seem to be having problems. The code is
below:

var strValue
strValue = XDocument.DOM.selectSingleNode"//my:Change/my:ChangeSubmit").text

XDocument.UI.Alert(strValue)

if (strValue.text = "false")
XDocument.ViewInfos("Main View").IsDefault = true;

if (strValue.text = "true")
XDocument.ViewInfos("TUG View").IsDefault = true;

The value (strValue) is correct and is giving me a true or false text value
via the alert. The problem I am having is that the "If" statement is not
recognising the value.

Any suggestions greatly appreciated.

Many thanks
Jackie

Russ said:
I don't know if this is what you are looking for (or if it would work), but
you could try including a hidden "emailed" field in your form somewhere, and
set it to true when the form is emailed. Then you can put a check in your
onLoad event to see if the "emailed" field is true, and set the view
accordingly.

:

I wouldn't know how to do this unless I knew the name of the form before
I submitted the form to the email.

Maui Williams | Solution Developer II, MCSD.Net
Avanade | West Region
2211 Elliott Avenue, Suite 200 Seattle, WA 98121

-----Original Message-----
From: Jackie [mailto:[email protected]]
Posted At: Wednesday, November 01, 2006 8:42 AM
Posted To: microsoft.public.infopath
Conversation: Identifying name of document
Subject: Identifying name of document

Can anyone help?

I have an InfoPath form that has a submit button. The submit button
sends
the form to an email address. When a user clicks on the form via the
email, I
would like them to see a different view (this view is already within the

form).

I have been looking at the OnLoad Event, which I have placed code that
changes the view (so this bit works !!). What I need is to identify the
form
via an If statement, which would wrap around the switching view line,
but am
having problems as I use VBA/VB.Net so am unfamiliar with the object
module.

Many thanks
 

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