Hi,

I want to copy a picklist value to a text field using the onLoad event. The
reason for this is because I was to record what the status reason was when
the record was last open. Therefore when the record gets disqualified we can
see what the status reason was when it was last open.

Is this possible?

Here is my code so far

var i;
i = crmForm.statuscode.value;
crmForm.new_statusreasonwhenlastopen.value = i;

Thanks

James

RE: Copying a picklist value using onLoad by Chris

Chris
Fri Sep 08 10:25:02 CDT 2006

You could try something like:

var i;

i = crmForm.all.statuscode.SelectedText;
crmForm.all.new_statusreasonwhenlastopen.DataValue = i;


"JamesE" wrote:

> Hi,
>
> I want to copy a picklist value to a text field using the onLoad event. The
> reason for this is because I was to record what the status reason was when
> the record was last open. Therefore when the record gets disqualified we can
> see what the status reason was when it was last open.
>
> Is this possible?
>
> Here is my code so far
>
> var i;
> i = crmForm.statuscode.value;
> crmForm.new_statusreasonwhenlastopen.value = i;
>
> Thanks
>
> James

Re: Copying a picklist value using onLoad by Michael

Michael
Fri Sep 08 10:46:53 CDT 2006

Hi James,

You can use one of the following to retrieve either the text or the integer
value of the state and status fields:

var stateText = crmForm.all.statecode.SelectedText;
var state = parseInt(crmForm.all.statecode.DataValue);
var statusText = crmForm.all.statuscode.SelectedText;
var status = parseInt(crmForm.all.statuscode.DataValue);

When assigning it to a field, use the DataValue property in favor of the
value property (crmForm.new_statusreasonwhenlastopen.DataValue). When saving
the value to a text field, you don't need to convert the state/status to an
integer with the parseInt function. However, if you want to create reports
later on, an integer value reflecting the status may be beneficial.

--
Michael

http://www.stunnware.com/crm2

----------------------------------------------------------

"JamesE" <JamesE@discussions.microsoft.com> schrieb im Newsbeitrag
news:8474257C-46F3-4B9A-9BF9-A7AF6AD91870@microsoft.com...
> Hi,
>
> I want to copy a picklist value to a text field using the onLoad event.
> The
> reason for this is because I was to record what the status reason was when
> the record was last open. Therefore when the record gets disqualified we
> can
> see what the status reason was when it was last open.
>
> Is this possible?
>
> Here is my code so far
>
> var i;
> i = crmForm.statuscode.value;
> crmForm.new_statusreasonwhenlastopen.value = i;
>
> Thanks
>
> James



Re: Copying a picklist value using onLoad by JamesE

JamesE
Fri Sep 08 11:11:03 CDT 2006

Hi Michael,

I've just tried the var stateText = crmForm.all.statecode.SelectedText;
syntax and the error 'crmForm.all.statecode.SelectedText' is null or not an
object appears.

Are you sure you can get the text from statecode. It would be good because
I want to only populate a field when the status is open.

Thanks for the prompt help.

James

"Michael Höhne" wrote:

> Hi James,
>
> You can use one of the following to retrieve either the text or the integer
> value of the state and status fields:
>
> var stateText = crmForm.all.statecode.SelectedText;
> var state = parseInt(crmForm.all.statecode.DataValue);
> var statusText = crmForm.all.statuscode.SelectedText;
> var status = parseInt(crmForm.all.statuscode.DataValue);
>
> When assigning it to a field, use the DataValue property in favor of the
> value property (crmForm.new_statusreasonwhenlastopen.DataValue). When saving
> the value to a text field, you don't need to convert the state/status to an
> integer with the parseInt function. However, if you want to create reports
> later on, an integer value reflecting the status may be beneficial.
>
> --
> Michael
>
> http://www.stunnware.com/crm2
>
> ----------------------------------------------------------
>
> "JamesE" <JamesE@discussions.microsoft.com> schrieb im Newsbeitrag
> news:8474257C-46F3-4B9A-9BF9-A7AF6AD91870@microsoft.com...
> > Hi,
> >
> > I want to copy a picklist value to a text field using the onLoad event.
> > The
> > reason for this is because I was to record what the status reason was when
> > the record was last open. Therefore when the record gets disqualified we
> > can
> > see what the status reason was when it was last open.
> >
> > Is this possible?
> >
> > Here is my code so far
> >
> > var i;
> > i = crmForm.statuscode.value;
> > crmForm.new_statusreasonwhenlastopen.value = i;
> >
> > Thanks
> >
> > James
>
>
>

Re: Copying a picklist value using onLoad by Michael

Michael
Fri Sep 08 13:42:32 CDT 2006

Yes, you can get these values. However you must include the fields on the
form, which I guess is the problem.

--
Michael
http://www.stunnware.com/crm2
----------------------------------------------------------
"JamesE" <JamesE@discussions.microsoft.com> schrieb im Newsbeitrag
news:B7AD70DD-3458-4F0C-B729-603E1A31780C@microsoft.com...
> Hi Michael,
>
> I've just tried the var stateText = crmForm.all.statecode.SelectedText;
> syntax and the error 'crmForm.all.statecode.SelectedText' is null or not
> an
> object appears.
>
> Are you sure you can get the text from statecode. It would be good
> because
> I want to only populate a field when the status is open.
>
> Thanks for the prompt help.
>
> James
>
> "Michael Höhne" wrote:
>
>> Hi James,
>>
>> You can use one of the following to retrieve either the text or the
>> integer
>> value of the state and status fields:
>>
>> var stateText = crmForm.all.statecode.SelectedText;
>> var state = parseInt(crmForm.all.statecode.DataValue);
>> var statusText = crmForm.all.statuscode.SelectedText;
>> var status = parseInt(crmForm.all.statuscode.DataValue);
>>
>> When assigning it to a field, use the DataValue property in favor of the
>> value property (crmForm.new_statusreasonwhenlastopen.DataValue). When
>> saving
>> the value to a text field, you don't need to convert the state/status to
>> an
>> integer with the parseInt function. However, if you want to create
>> reports
>> later on, an integer value reflecting the status may be beneficial.
>>
>> --
>> Michael
>>
>> http://www.stunnware.com/crm2
>>
>> ----------------------------------------------------------
>>
>> "JamesE" <JamesE@discussions.microsoft.com> schrieb im Newsbeitrag
>> news:8474257C-46F3-4B9A-9BF9-A7AF6AD91870@microsoft.com...
>> > Hi,
>> >
>> > I want to copy a picklist value to a text field using the onLoad event.
>> > The
>> > reason for this is because I was to record what the status reason was
>> > when
>> > the record was last open. Therefore when the record gets disqualified
>> > we
>> > can
>> > see what the status reason was when it was last open.
>> >
>> > Is this possible?
>> >
>> > Here is my code so far
>> >
>> > var i;
>> > i = crmForm.statuscode.value;
>> > crmForm.new_statusreasonwhenlastopen.value = i;
>> >
>> > Thanks
>> >
>> > James
>>
>>
>>



Re: Copying a picklist value using onLoad by JamesE

JamesE
Wed Sep 13 03:01:03 CDT 2006

Here is my code to copy the status reason to another field when the status is
open, does anyone know why the value in the field does not persist when the
status changes?

var stateText;
var statusText;
stateText = crmForm.all.statecode.SelectedText;
statusText = crmForm.all.statuscode.SelectedText;
if(stateText == "Open"){
crmForm.all.new_statusreasonwhenlastopen.DataValue =statusText;
}