- Populating fields from Custom form to an Original form
- Posted by N8 on March 1st, 2004
Hi all,
I am building a custom form (modal dialog window) with the SDK which
opens on top of the opportunity form. Its purpose is to extract users
from the database in a dropdown list and allows the client to select
one and populate the selected value back into a text field in the
Opportunity form. I have about 7 fields to populate to the Opportunity
form which explains the need for a custom form.
The problem arises when I want to populate the Opportunity fields from
the select item chosen from the drop-down box. My colleague
recommended using JavaScript specifically the 'onblur' method and/or
session variables. However is there a quick and dirty method of
extracting values from one form and populating another one.
I already have a JavaScript method on my custom page which does the
following:
-------------------------------------------------------------------------
document.CrmForm.TextField.value = DropDownList.SelectedItem.Text;
-------------------------------------------------------------------------
ie. put value on the dropdown list on custom form and populate it to
Opp form
Note:
CrmForm > the form id of the Opportunity form
DropDownList.SelectedItem.Text > Value in the Custom form
I have development done on my local machine and the CRM exists on a
server. I believe it has to do with this separation but need
confirmation and help!
Cheers,
Nathan
- Posted by GreaterThanTwo Media on March 1st, 2004
Hi Nathan, I wouldn't recommend onblur, and session is definately NOT the
way to go. You need to use javascript to copy field values between the two
form. You could fire the javascript off of a button on your custom form.
The button would update the parent form (ie. window.opener.document), and
could then close your custom window.
You might want to refer to the MSDN DHTML reference for more details.
http://msdn.microsoft.com/workshop/a...ies/opener.asp
Mike
greaterthantwo media
Printable Quotes, Orders and Invoices, with line-item details, now
availablefor MSCRM.
http://www.greaterthantwo.com
"N8" <nathan_g_cho@yahoo.co.nz> wrote in message
news:ad98347.0402292004.9815671@posting.google.com ...
- Posted by Erik Juhlin on March 2nd, 2004
Dirty solution
In your onload-event add something like
MyForm.Mycontrol.value = window.opener.crmForm.name.value
- Posted by N8 on March 5th, 2004
Great, thanks for that Mike.
I have sorta got it to work however when trying to popluate the field
on the parent form via the child form, I cannot find the particular
field name. For example I want to populate some text field value from
my child form (custom form) to text field in the parent form
(opportunity form) by the following:
window.opener.document.crmForm.CFF_x.value =
lsCompanies.SelectedItem.value;
where CFF_x is the name of my custom field. an error comes up saying
that the
"window.opener.document.crmForm.CFF_x" is null or not an object"
I understand this error as there is no initation of that field in the
C:\Inetpub\wwwroot\SFA\opps\edit.aspx page.
Therefore the fields must be contained in another file in which links
the edit.aspx page together to produce the content matter on screen.
The question is , where in the system is that particular file?
Cheers
Nathan
"GreaterThanTwo Media" <nospam_info@greaterthantwo.com> wrote in message news:<#Hm3MN7$DHA.2292@TK2MSFTNGP12.phx.gbl>...
- Posted by Greaterthantwo Media on March 6th, 2004
Hi Nathan, you just need to get your javascript syntax right. Are you sure
"CFF_x" is a field on your edit.aspx page? The code below works for me:
// parent window field value = this window field value
window.opener.document.crmForm.CFSenduserclientid. value=document.frmGT2.txtN
umber.value;
window.opener.document.crmForm.CFSenduserclientnam e.value=document.frmGT2.tx
tName.value;
Mike
Greaterthantwo Media
Printable Quotes, Orders and Invoices, with line-item details, now available
for MSCRM.
http://www.greaterthantwo.com
"N8" <nathan_g_cho@yahoo.co.nz> wrote in message
news:ad98347.0403041721.68064b0@posting.google.com ...
- Posted by Greaterthantwo Media on March 6th, 2004
If that doesn't work for you, use the JS debugging tools included with
Windows/VS.NET. JS can be finiky at times.
Mike
"N8" <nathan_g_cho@yahoo.co.nz> wrote in message
news:ad98347.0403041721.68064b0@posting.google.com ...