Jump to content

Add form date field using same style as in admin pages


datamerc

Recommended Posts

I'm creating custom pages for my client portal. Some of the forms require a date field and I would like to make them just like what is used in the admin section (for example, on the registration date field on the domains page of a client).

 

How can I utilize that same pop-up calendar in my custom pages?

 

Thanks!

Link to comment
Share on other sites

After many days, I've made some progress in getting this worked out - except one problem.

 

In header.tpl, I have included the following:

<link rel="stylesheet" type="text/css" href="includes/jscript/css/ui.all.css" />
<script type="text/javascript" src="includes/jscript/jquery.js"></script>
<script type="text/javascript" src="includes/jscript/jqueryui.js"></script>	

{literal}<script>
 $(document).ready(function(){
   $(".datepick").datepicker({
       dateFormat: "{/literal}{$datepickerformat}{literal}",
       showOn: "button",
       buttonImage: "images/showcalendar.gif",
       buttonImageOnly: true,
       showButtonPanel: true
   });
   {/literal}{$jquerycode}{literal}
 });{/literal}
 {$jscode}
</script>

 

In my newform.tpl file, I have the following field for the date:

<input type="text" name="date_from" class="datepick">

 

The calendar looks and pops up properly. However, when a date on the pop-up calendar is clicked on, a text date (MM/DD/YYYY) is not put into the field, it is just blank. I can't figure out why this doesn't work - do the form fields have to be registered somewhere?

 

Thank you for any help!!!

Link to comment
Share on other sites

One difference I have noticed between my created page and the original admin page, is the link url when hovering over a date in the calendar.

 

On the original admin page, the date link is:

http://www.domain.com/whmcs/admin/clientsdomains.php?userid=21#'>http://www.domain.com/whmcs/admin/clientsdomains.php?userid=21#

when the page url is http://www.domain.com/whmcs/admin/clientsdomains.php?userid=21

 

 

On my created page, the date link is just:

http://www.domain.com/whmcs/#

when the page url is http://www.domain.com/whmcs/21.php?action=test_calendar

 

 

As you can see, my created page is not setting a proper link within the calendar (which it is probably returning a blank result to the date form field). What have I missed???

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated