function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
kevinvwkevinvw 

custom datepicker

I'm pretty new to this and I see other people have struggled with custom date pickers...

 

I have a custom VF task page.  I am trying to mimic the reminder section of the standard task screen.

 

I am usting an outputPanel so I can have a checkbox, input field (for date) and select field (for time).

 

The fields display fine and the datepicker lets me pick a date, but when I save, I am not able to get the selected date value back into my controller class.  The !ReminderDate comes back empty.

The !ReminderTime comes back fine.  

Neither field is bound to an SObject.

 

Is there another way?

 

Thanks,  Kevin.

 

 

             <apex:pageBlockSection title="Reminder" collapsible="false" rendered="true">                
                <apex:pageBlockSectionItem >
                    <apex:outputLabel id="taskAddReminderLabel" for="taskAddReminder" value="Add Reminder" />                    
                    <apex:outputPanel id="taskAddReminderOutputPanel" >
                    <apex:inputCheckbox id="taskAddReminder" value="{!AddReminder}">
                        <!-- <apex:actionSupport event="onchange" rerender="taskInformation" action="{!Refresh}"/> -->
                    </apex:inputCheckbox>                                        
                    <span id="dateSpan" class="dateInput dateOnlyInput"><input id="taskReminderDate2" name="taskReminderDate2" value="{!ReminderDate}" onfocus="DatePicker.pickDate(true, 'taskReminderDate2', false);" size="12" type="text" /><span class="dateFormat"></span></span>                    
                    <apex:selectList id="taskAddReminderSelectList" value="{!ReminderTime}" multiselect="false" size="1">
                        <apex:selectOptions value="{!TaskReminderList}"/>
                    </apex:selectList>                 
                    </apex:outputPanel>                                    
                </apex:pageBlockSectionItem>            
            </apex:pageBlockSection>   

 

 

dwwrightdwwright

I notice that the !ReminderDate field is inside an <input> tag, as opposed to an <apex:inputField> or <apex:inputText> tag. I don't know whether or not the controller can utilize the value attribute of a non visualforce tag. Have you tried setting that field to the visualforce version of <input> (<apex:inputText>)?

kevinvwkevinvw

Hi Thanks for the reply.  I tried using an apex tag, but then I couldn't get the datepicker attribute to work with apex:InputText.  Also an apex InputField only seems to work if it is attached to SObject.

kevinvwkevinvw

I found a solution.

 

in the apex code I can use this to get the value from the datepicker field -

 

ApexPages.currentPage().getParameters().get('taskReminderDate2')

 

Terry411Terry411

Kevin,

 

I thought the currentPage().getParameters()... only returned values from the URL.  Is ther anything else you did to get the datepicker to work?  Would you mind posting the entry code set?