This is a migrated thread and some comments may be shown as answers.

Prepopulating Advanced Form fields on click

6 Answers 63 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Dmitri
Top achievements
Rank 1
Dmitri asked on 23 Feb 2016, 01:26 PM

I am trying to prepopulate certain data in the advanced form client side. Regardless of what I do when the form opens the subject field is blank and i get the validation warning to enter a subject...

Here is my code can you please tell me what i am doing wrong and thanks

<script type="text/javascript">
    function AdjustHeader(obj, args) {
        if (args.get_item().get_text().indexOf('Availability') > 0)
            formatAppointment(true);
        else if (args.get_item().get_text().indexOf('Class') > 0)
            formatAppointment(false);
    }
    function formatAppointment(isPriv) {
        $(".rsAllDayWrapper").hide();
        var subjectJQueryObject = $telerik.$("[id$='Form_Subject']");
        var subjectRadTextBoxObject = $find(subjectJQueryObject.attr("id"));
        alert(subjectJQueryObject.attr("id"));
        if (isPriv) {
            $(".rsAdvTitle").html("New Private Session Availability");
            subjectRadTextBoxObject.set_value("Open for private training");
            $("#" + idPrefix + "Subject_Label").html(" ")
        } else {
            $(".rsAdvTitle").html("New Group Class");
            $("#" + idPrefix + "Subject_Label").html("Class Name")
        }
    }
</script>

<telerik:RadScheduler RenderMode="Lightweight" runat="server" ID="schedTrainer" Height="590" OverflowBehavior="Auto"
    SelectedView="WeekView" ShowFooter="false" FirstDayOfWeek="Monday" LastDayOfWeek="Sunday"
    EnableDescriptionField="true" AppointmentStyleMode="Default" Skin="Telerik"
    OnResourcesPopulating="schedTrainer_ResourcesPopulating" OnClientResourcesPopulating="popUser"
    OnClientAppointmentsPopulating="popUser" OnClientAppointmentWebServiceDeleting="popUser"
    OnClientAppointmentWebServiceUpdating="popUser" OnClientAppointmentWebServiceInserting="popUser"
    StartEditingInAdvancedForm="true" StartInsertingInAdvancedForm="true"
    DayView-ShowAllDayInsertArea="false" MultiDayView-ShowAllDayInsertArea="false" WeekView-ShowAllDayInsertArea="false"
    ShowAllDayRow="false"               
    OnClientTimeSlotContextMenuItemClicking="AdjustHeader"
    >
    <AdvancedForm EnableResourceEditing="false" />
    <TimeSlotContextMenus>
        <telerik:RadSchedulerContextMenu runat="server" ID="TimeContextMenu">
            <Items>
                <telerik:RadMenuItem Text="Add Recurring Availability" Value="CommandAddRecurringAppointment" />
                <telerik:RadMenuItem Text="Add Recurring Class" Value="CommandAddRecurringAppointment" />
                <telerik:RadMenuItem IsSeparator="True" />
                <telerik:RadMenuItem Text="Add Spot Availability" Value="CommandAddAppointment" />
                <telerik:RadMenuItem Text="Add Spot Class" Value="CommandAddAppointment" />
                <telerik:RadMenuItem IsSeparator="True" />
                <telerik:RadMenuItem Text="Go to today" Value="CommandGoToToday" />
                <telerik:RadMenuItem Text="Show 24 hours..." Value="CommandShow24Hours" />
            </Items>
        </telerik:RadSchedulerContextMenu>
    </TimeSlotContextMenus>
    <WebServiceSettings Path="../../WebService/Scheduler.asmx" ResourcePopulationMode="ClientSide" />
    <AdvancedForm Modal="true"></AdvancedForm>
    <TimelineView UserSelectable="false"></TimelineView>
    <AgendaView UserSelectable="true" />
    <ResourceStyles>
        <%--AppointmentStyleMode must be explicitly set to Default (see above) otherwise setting BackColor/BorderColor
    will switch the appointments to Simple rendering (no rounded corners and gradients)--%>
        <telerik:ResourceStyleMapping Type="Calendar" Text="Personal"
            BorderColor="#abd962" />
        <telerik:ResourceStyleMapping Type="Calendar" Text="Work"
            BorderColor="#25a0da" />
    </ResourceStyles>
    <ResourceHeaderTemplate>
        <div class="rsResourceHeader<%# Eval("Text") %>">
            <%# Eval("Text") %>
        </div>
    </ResourceHeaderTemplate>
    <TimeSlotContextMenuSettings EnableDefault="true" />
    <AppointmentContextMenuSettings EnableDefault="true" />
    <Localization HeaderWeek="Work week" />
</telerik:RadScheduler>

6 Answers, 1 is accepted

Sort by
0
Mehmet
Top achievements
Rank 1
answered on 24 Feb 2016, 12:26 AM

Hi Dmitri,

Cannot you pass the data ID to the AdvancedForm and capture and bind the information calling from the database by the  
This is what I do:

1.function AppointmentEditing(sender, eventArgs) {
2.                    var apt = eventArgs.get_appointment();
3.                    window.radopen("AdvancedForm.aspx?jID=" + apt._id, "EditForm");
4.                    eventArgs.set_cancel(true);
5.                }

0
Mehmet
Top achievements
Rank 1
answered on 24 Feb 2016, 01:04 AM

Hi Dmitri,

Cannot you pass the ID through to the AdvancedForm and re-bind the information onto it by calling from the DB?
I am having a similar case and I gotta bind some other information on the AdvancedForm popup so retrieve all from the DB.

0
Dmitri
Top achievements
Rank 1
answered on 24 Feb 2016, 01:48 AM

The problem is the system seems to be ignoring 

subjectRadTextBoxObject.set_value("Open for private training");

as that doesnt seem to do anything despite the fact that the object is correct (i verified the ID) and this is from the documentation provided by Telerik on how to interact, client-side, with the advanced from fields...

0
Mehmet
Top achievements
Rank 1
answered on 24 Feb 2016, 03:33 AM

I understand your point.

Btw, I have noticed that you are calling the web service to bind the data on the . 
Are u experiencing any performance issue so far?

0
Dmitri
Top achievements
Rank 1
answered on 24 Feb 2016, 03:37 AM
Not in my DEV environment but havent tested in a production environment yet. In DEV it runs very smoothly and I am able to trap breakpoints in the webservice without issue...
0
Mehmet
Top achievements
Rank 1
answered on 24 Feb 2016, 03:42 AM
In the dev environment all can be smooth but when it gets to the level, also binding lots of information ( 3 months old - 6 months ahead in my case) that gets heavier with the resources that you have on the .
I am investigating whether I can only load the current month data and it gets reloaded once the month is navigated through previous-next one.  It appears that It doesn't come up the right date range for each click on the (previous, next, calendar selection, month etc.). 
Tags
Scheduler
Asked by
Dmitri
Top achievements
Rank 1
Answers by
Mehmet
Top achievements
Rank 1
Dmitri
Top achievements
Rank 1
Share this question
or