Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic rewrite the "New Appointment" window (Read 5678 times)
Xylon
Junior Member
**
Offline


I Love MindFusion!

Posts: 96
Joined: Feb 17th, 2014
rewrite the "New Appointment" window
Mar 26th, 2014 at 8:01pm
Print Post  
Hi,

So confused...what I am working on now is to rewrite the "New Appointment" window, set "subject" line as a textbox which can be input manually, set location line as a dropdownlist, its values are read from a string list. But I had an error bothered me long time...
"0x800a138f - JavaScript runtime error: Unable to get property 'id' of undefined or null reference"

I am pretty sure the error is from the "subject" textbox line whereas if I hide "location" line and set "subject" as a dropdownlist instead, it works. If I hide location line, only have a default "subject" as textbox, it has same error info as above.

That means, the dropdownlist works on "subject", doesn't work on "location"...

My code is below:
Code (Javascript)
Select All
var a = JSON.parse('<% = this.javaSerial.Serialize(this.eventValue) %>');

		    var populateEventTypeItems = function ()
		    {
		        var result = [];
		        for (var i = 0; i < a.length; i++) {
		            result.push({value: a[i], text: a[i]});
		        }
		        return result;
		    }

		    // Cache the original drawContent function
		    var drawContentOriginal = MindFusion.Scheduling.EditForm.prototype.drawContent;

		    // EditForm.drawContent override
		    MindFusion.Scheduling.EditForm.prototype.drawContent = function () {
		        // Draw the form's content
		        drawContentOriginal.apply(this, arguments);

var eventType = this.createDropDownList({
		            id: 'location',
		            items: populateEventTypeItems(),
		            initValue: this.item.location,
		            addEmptyValue: false
		        });
		        eventType.element.style.width = "355px"

var locationOriginal = this.getControls()['location'];
		        locationOriginal.element.parentNode.appendChild(eventType.element);

		        locationOriginal.element.parentNode.removeChild(locationOriginal.element);


this.getControls()['location'] = eventType;

		        // Hide the reminder row
		        this._content.find('div.reminder-row')[0].style.display = 'none';
		        this._content.find('div.hr-line')[1].style.display = 'none';
		        // Hide the contacts list
		        this._content.find('table')[1].rows[0].cells[1].style.display = 'none';
		        // Adjust the details area size
		        this.getControls()['details'].element.style.width = "430px";
		    };

 



Can anyone give any hint? Big thx
  

q11.JPG (Attachment deleted)
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: rewrite the "New Appointment" window
Reply #1 - Mar 27th, 2014 at 10:29am
Print Post  
Hi,

The code above was written with the intent that it will be used for the subject textbox, as was your initial request. The location control is already a drop-down list and works differently - that's why the above code throws the exception.

To display your location values in the form's location drop-down - add them to the Schedule.Locations collection. The list in the form will be automatically populated from there. An Appointment can be associated with a Location object by setting its Location property.

Regards,
Lyubo
  
Back to top
 
IP Logged
 
Xylon
Junior Member
**
Offline


I Love MindFusion!

Posts: 96
Joined: Feb 17th, 2014
Re: rewrite the "New Appointment" window
Reply #2 - Mar 27th, 2014 at 2:36pm
Print Post  
Oh yea, it works now. I complicated it....

Thank you very much!

Lyubo wrote on Mar 27th, 2014 at 10:29am:
Hi,

The code above was written with the intent that it will be used for the subject textbox, as was your initial request. The location control is already a drop-down list and works differently - that's why the above code throws the exception.

To display your location values in the form's location drop-down - add them to the Schedule.Locations collection. The list in the form will be automatically populated from there. An Appointment can be associated with a Location object by setting its Location property.

Regards,
Lyubo

  
Back to top
 
IP Logged
 
Xylon
Junior Member
**
Offline


I Love MindFusion!

Posts: 96
Joined: Feb 17th, 2014
Re: rewrite the "New Appointment" window
Reply #3 - Mar 27th, 2014 at 3:39pm
Print Post  
Btw, I invoke "ItemDeletingScript="ConfirmDelete"" to confirm appointment delete action on my calendar, but none of my function works....no matter I click or cancel, the selected appointment will deleted anyway....Below are my functions, I tried 4 functions but....

Code (Javascript)
Select All
function ConfirmDelete3()
		    {
		        var x = confirm("Are you sure you want to delete?");
		        if (x == true)
		            return true;
		        else
		            return false;
		    }

		    function ConfirmDelete1() {
		        if (confirm("Are you sure you want to delete this record?"));
		    }

		    function ConfirmDelete2() {

		        var del = confirm("Are you sure you want to delete this record?");
		        if (del == true) {
		            alert("record deleted")
		        }
		        else {
		            alert("Record Not Deleted")
		        }
		        return del;
		    }

		    function ConfirmDelete(nam) {
		        var dl = "Object";
		        var ot = nam;
		        if (ot.toString().length > 1) { dl = nam; }
		        return confirm("Are you sure you wish to delete this " + dl + "?");
		    } 



Lyubo wrote on Mar 27th, 2014 at 10:29am:
Hi,

The code above was written with the intent that it will be used for the subject textbox, as was your initial request. The location control is already a drop-down list and works differently - that's why the above code throws the exception.

To display your location values in the form's location drop-down - add them to the Schedule.Locations collection. The list in the form will be automatically populated from there. An Appointment can be associated with a Location object by setting its Location property.

Regards,
Lyubo
  
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: rewrite the "New Appointment" window
Reply #4 - Mar 28th, 2014 at 7:40am
Print Post  
Hi,

Usage of the client side events is explained in detail in the documentation files here.

In your specific case, to prevent deleting of an appointment, you should call the set_cancel method of the event args parameter (also note that you'll need to include the required parameters in your handler's signature):

Code (Javascript)
Select All
function confirmDelete(sender, args) {
    if (!confirm("Are you sure you want to delete?"))
        args.set_cancel(true);
} 



Regards,
Lyubo
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint