Fill form fields for new event

Hi!

I am trying to fill form fields in the shadowbox based on URL variables.

This works GREAT:

  scheduler.attachEvent("onBeforeLightbox", function (event_id){
        var ev = scheduler.getEvent(event_id);
        if(scheduler._new_event){
        ev.patient_ID= <?php echo $_GET['Patient_ID']; ?>;
        }
        return true;
});

When the form loads the form field “patient_ID” is automatically filled from the URL variable.
When I try to fill also another form field called “name” the scheduler loads but not correctly: my database records are not shown, the details form doesn’t appear when I double click, records are not saved.

What’s wrong with this code?:

  scheduler.attachEvent("onBeforeLightbox", function (event_id){
        var ev = scheduler.getEvent(event_id);
        if(scheduler._new_event){
        ev.patient_ID= <?php echo $_GET['Patient_ID']; ?>;
	ev.name= <?php echo $_GET['Name']; ?>;
        }
        return true;
});

Thanks!!!

Most probably - you need to surround the string by quotes.

ev.name= "<?php echo $_GET['Name']; ?>";

Works great! I should have thought of that. I owe you one.

Thanks again.