error using g_useDialogAlwaysList
I am attempting to open related for in a dialog but keep hitting this error.
Uncaught ReferenceError: g_useDialogAlwaysList is not defined.
If I declare it I then get
Uncaught TypeError: Cannot read property 'push' of undefined
Any thoughts. What am I missing?
If I can figure this out I will be able to populate the fields on the related forms then return to the correct parent form when done.
When I get it I will need to work this in. Probably in an array format.
Uncaught ReferenceError: g_useDialogAlwaysList is not defined.
If I declare it I then get
Uncaught TypeError: Cannot read property 'push' of undefined
Any thoughts. What am I missing?
If I can figure this out I will be able to populate the fields on the related forms then return to the correct parent form when done.
When I get it I will need to work this in. Probably in an array format.
Code: Select all
var newFormUrl1 = '/sites/CRFs/Lists/Observations/NewForm.aspx?TC=1. Rituxan Consumables Collection&AGName=N/A';
var newFormUrl2 = '/sites/CRFs/Lists/Observations/NewForm.aspx?TC=2. Reconstitution of IV Rituxan in Pharmacy/ Sign-off of Prepared Rituxan Bag&AGName=Rituxin';
var newFormUrl3 = '/sites/CRFs/Lists/Observations/NewForm.aspx?TC=3. Peripheral Access Insertion&AGName=N/A';
var newFormUrl4a = '/sites/CRFs/Lists/Observations/NewForm.aspx?TC=4A. Pre-medication Administration & Agent Name (new task per agent)&AGName=';
Code: Select all
for (var i = 0; i < 14; i++) { //Rows
//alert(i);
var g_useDialogAlwaysList;
var newFormUrl = '/sites/HopeStudies/CRFs/Lists/HTMRI1620%20%20Observations/NewForm.aspx?TC=' + i;
var uri = new URI(newFormUrl);
var url = uri.getLastPathSegment();
[b]g_useDialogAlwaysList.push(url.toLowerCase());[/b]
//Here we replace the standard 'New item' link with our custom link:
$('.ms-list-addnew a').eq(i).attr('onclick', 'NewItem2(event, "' + newFormUrl + '");return false;');
}
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Hi Greg,
Try to define g_useDialogAlwaysList as a global array:
instead of this:
use:
Try to define g_useDialogAlwaysList as a global array:
instead of this:
Code: Select all
var g_useDialogAlwaysList;
Code: Select all
window.g_useDialogAlwaysList = window.g_useDialogAlwaysList || [];
Thank you.
That got rid of the error but I still had issues passing values. Deadlines, i am sure I would have figured it out.
This seems to work now.
That got rid of the error but I still had issues passing values. Deadlines, i am sure I would have figured it out.
This seems to work now.
Code: Select all
////WebPartWPQ2
$('#WebPartWPQ2 #idHomePageNewItem').attr('href', function (i, val1) {
return val1 + '&TC=1. Rituxan Consumables Collection&AGName=N/A&';
});
var href = $('#WebPartWPQ2 #idHomePageNewItem').attr('href');
$('#WebPartWPQ2 #idHomePageNewItem').attr('onclick', function () {
return 'javascript:NewItem2(event, "' + href + '");javascript:return false;';
});
////WebPartWPQ3
$('#WebPartWPQ3 #idHomePageNewItem').attr('href', function (i, val2) {
return val2 + '&TC=2. Reconstitution of IV Rituxan in Pharmacy/ Sign-off of Prepared Rituxan Bag&AGName=Rituxan&';
});
var href = $('#WebPartWPQ3 #idHomePageNewItem').attr('href');
$('#WebPartWPQ3 #idHomePageNewItem').attr('onclick', function () {
return 'javascript:NewItem2(event, "' + href + '");javascript:return false;';
});
////WebPartWPQ4
$('#WebPartWPQ4 #idHomePageNewItem').attr('href', function (i, val3) {
return val3 + '&TC=3. Peripheral Access Insertion&AGName=N/A&';
});
var href = $('#WebPartWPQ4 #idHomePageNewItem').attr('href');
$('#WebPartWPQ4 #idHomePageNewItem').attr('onclick', function () {
return 'javascript:NewItem2(event, "' + href + '");javascript:return false;';
});
////WebPartWPQ5
$('#WebPartWPQ5 #idHomePageNewItem').attr('href', function (i, val4) {
return val4 + '&TC=4A. Pre-medication Administration and Agent Name (new task per agent)&AGName=&';
});
var href = $('#WebPartWPQ5 #idHomePageNewItem').attr('href');
$('#WebPartWPQ5 #idHomePageNewItem').attr('onclick', function () {
return 'javascript:NewItem2(event, "' + href + '");javascript:return false;';
});
-
- Information
-
Who is online
Users browsing this forum: No registered users and 3 guests