![]() | ![]() |
|
01-11-2012 01:30 PM - last edited on 01-11-2012 01:36 PM
I have an admin form, myAdminForm, with two date fields, Local.dtmStart and Local.dtmEnd, and a command button that opens another admin form, mySecondForm.
From the MySecondForm I am trying to get the myAdminForm date field values, like this:
myAdminForm af = new myAdminForm();
local.dtmStart = af.Current.Local.dtmStart;
The date fields have Field is dependent on another checked.
The af.Current.Local.dtmStart command, however, is returning nothing.
Has anyone try this? Any ideas?
Thanks,
Stephen
01-11-2012 01:55 PM - last edited on 01-11-2012 01:56 PM
Hi Stephen,
Is it absolutely necessary to do this on the server? Have you tried passing the values as dialog parameters between your Admin forms client side with javascript? I don't think Local variables' scope will allow what you're trying to do between forms.
In this example, OpenCalledForm() is on the calling button on the 1st Admin form… LoadCalledForm() is on the Load event of the 2nd Admin form. Textfields are used here but Datetime fields also support the getField() and setField() functions.
function OpenCalledForm() {
{
//Set up the parameters to be passed onto the other form if desired
var param = getField("txtFirstName","") + "," + getField("txtMiddleName","") + "," + getField("txtLastName","");
//Customize the called form's appearance if desired
var settings = "centre:yes;resizable:no;dialogHeight:225px;dialog
//Set up the Action and Map - refer to Web Client configuration Guide Section: 4
var action = "MyAdminForm";
var map = "MyAdminFormGroup";
//Call the eForm.aspx passing in query string (be wary of special characters)
var url = "eForm.aspx?Map=" + map + "&Client=External&Action=" + action + ""
//Call the modal dialog
var returnedVal = window.showModalDialog(url, param, settings);
}
return true;
}
function LoadCalledForm() {
//Get dialog parameters
var param = window.dialogArguments;
//Split on comma (or whatever delim you choose) into string array
//and loop for each setting the fields
var s = param.split(",")
for (var i = 0;i<=s.length-1;i++){
//Set the values of the form fields
if (i==0){ setField("txtFirstName","",s[0]);}
if (i==1){ setField("txtMiddleName","",s[1]);}
if (i==2){ setField("txtLastName","",s[2]);}
}
return true
}
01-11-2012 02:03 PM
Another way to do it, which I feel is even easier, is to use a Status field type to do the drill down to the 2nd admin form rather than using a command button. 9.1 introduced the ability to easily configure drill-down and passing of parameters from one form to another using the Status field's drill down properties and the expression builder.
01-11-2012 02:14 PM
01-11-2012 02:14 PM
01-11-2012 02:33 PM
01-11-2012 03:21 PM
Stephen,
Try this. If the attachment doesn't post, then send an email to helpdesk.
01-11-2012 04:55 PM - last edited on 01-11-2012 04:56 PM
First off, you cannot access values in other forms like this. If you think about it for a moment, the server has absolutely no idea which instance of this form you are referring to.
As suggested, we typically use a client script to manage this. We do it very often. We have simple SetCookieFromField() and SetFieldFromCookie() functions in our Library (from the link below) that allow us to pass all required variables with the absolute minimum of code. We then just use the 'Initiate a process' type of button.
In our experience, once you get more complex than that, it keeps breaking in future versions and creates a maintenance nightmare.
04-03-2012 05:32 PM
![]() |
![]() |
![]() |
|
|
![]() |
![]() |
![]() |
















