I have a form that is in a popup, but I can not get the datepicker to work (when clicking on the Data Started field, the calendar is not popping up). Here is my code for the page:
<?php
require_once('inc/header.inc.php'); require_once(BX_DIRECTORY_PATH_INC . 'design.inc.php'); require_once(BX_DIRECTORY_PATH_INC . 'profiles.inc.php'); require_once(BX_DIRECTORY_PATH_INC . 'utils.inc.php'); require_once(BX_DIRECTORY_PATH_CLASSES . 'BxDolEmailTemplates.php');
bx_import('BxTemplFormView');
// --------------- page variables and login
$_page['name_index'] = 29; $_page['css_name'] = array('forms_adv.css');
$_page['header'] = _t("Add Current Medications"); $_page['header_text'] = _t("Add Current Medications"); $_page['extra_js'] .= '<script type="text/javascript" language="JavaScript" src="plugins/jquery/jquery.ui.datepicker.min.js"></script>'; $profileID = 0; if( isset($_GET['ID']) ) { $profileID = (int) $_GET['ID']; } else if( isset($_POST['ID']) ) { $profileID = (int) $_POST['ID']; }
$iSenderID = getLoggedId(); $aSenderInfo = getProfileInfo($iSenderID);
// --------------- page components
$sCaption = ($profileID) ? _t('Please use this form to input any type of Medications you are currently taking.', $site['title']) : _t('Please use this form to input any type of Medications you are currently taking.', $site['title']);
$aForm = array( 'form_attrs' => array( 'id' => 'add_current_medications', 'name' => 'add_current_medications', 'action' => BX_DOL_URL_ROOT . 'current-medications-add.php', 'method' => 'post', 'onsubmit' => "return bx_ajax_form_check(this)", ), 'params' => array ( 'db' => array( 'submit_name' => 'do_submit', // we need alternative hidden field name here, instead of submit, becuase AJAX submit doesn't pass submit button value ), ), 'inputs' => array ( 'header1' => array( 'type' => 'block_header', 'caption' => $sCaption, ), 'do_submit' => array( 'type' => 'hidden', 'name' => 'do_submit', // hidden submit field for AJAX submit 'value' => 1, ), 'id' => array( 'type' => 'hidden', 'name' => 'ID', 'value' => $profileID, ), 'MedName' => array( 'type' => 'text', 'name' => 'MedName', 'colspan' => '2', 'caption' => _t("Name(s) of the medication and dose form (e.g. Prozac/Fluoxetine 20mg): (Online drug information can be found at Epocrates.com)"), ), 'header2' => array( 'type' => 'block_header', 'caption' => _t("Prescription (exactly as written on bottle, e.g. one pill two times per day for 30 days, 2 Refills"), ), 'TakeNumber' => array( 'type' => 'select', 'name' => 'TakeNumber', 'caption' => _t("Take"), ), 'MedForm' => array( 'type' => 'select', 'name' => 'MedForm', 'caption' => _t("Med FOrm"), ), 'Route' => array( 'type' => 'select', 'name' => 'Route', 'caption' => _t("Route"), ), 'TimesPerDay' => array( 'type' => 'select', 'name' => 'TimesPerDay', 'caption' => _t("Times per Day"), ), 'NumberOfDays' => array( 'type' => 'select', 'name' => 'NumberOfDays', 'caption' => _t("Number of Days"), ), 'Reason' => array( 'type' => 'text', 'name' => 'Reason', 'colspan' => '2', 'caption' => _t("What is the medicine supposed to do for you (if you know)?"), ), 'Refills' => array( 'type' => 'text', 'name' => 'Refills', 'caption' => _t("Refills"), ), 'DateStarted' => array( 'type' => 'date', 'name' => 'DateStarted', 'caption' => _t("When did you start taking the medicine? (Approximate dates are fine)"), ), 'Usage' => array( 'type' => 'select', 'name' => 'Usage', 'caption' => _t("Please describe how often you take this medication (compared to how it is prescribed)"), ), 'Comments' => array( 'type' => 'text', 'name' => 'comments', 'colspan' => '2', 'caption' => _t("Please describe whether the medication has been helpful or not, any side effect(s) of it (including sexual, menstrual-related or other potentially embarrassing ones) as well as any other questions or comments about this medication"), ), 'submit_send' => array( 'type' => 'submit', 'name' => 'submit_send', 'value' => _t("Add Medications"), ), ) );
// generate form or form result content $oForm = new BxTemplFormView($aForm); $oForm->initChecker(); if ($oForm->isSubmittedAndValid()) { $s = SubmitMedications($iSenderID) ? _t("Medications Input Success") : _t("Medications Input Fail"); $sPageCode = MsgBox(_t($s)); } else { $sPageCode = $oForm->getCode(); }
// output AJAX form submission result if (bx_get('BxAjaxSubmit')) { header('Content-type:text/html;charset=utf-8'); echo $sPageCode; exit; }
$sPageCode = $GLOBALS['oSysTemplate']->parseHtmlByName('default_margin.html', array('content' => $sPageCode));
// output ajax popup if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') { $aVarsPopup = array ( 'title' => $_page['header'], 'content' => $sPageCode, ); header('Content-type:text/html;charset=utf-8'); echo $GLOBALS['oFunctions']->transBox($GLOBALS['oSysTemplate']->parseHtmlByName('popup_mncomp_medications.html', $aVarsPopup), true); exit; }
// output regular page $_ni = $_page['name_index']; $_page_cont[$_ni]['page_code'] = $sPageCode; PageCode();
// --------------- page components functions
function SubmitMedications($iSenderID = 0) { global $profileID; if(! get_magic_quotes_gpc() ) { $sMedName = addslashes ($_POST['MedName']); $sTakeNumber = addslashes ($_POST['TakeNumber']); $sMedForm = addslashes ($_POST['MedForm']); $sRoute = addslashes ($_POST['Route']); $sTimesPerDay = addslashes ($_POST['TimesPerDay']); $sNumberOfDays = addslashes ($_POST['NumberOfDays']); $sRefills = addslashes ($_POST['Refills']); $sUsage = addslashes ($_POST['Usage']); $sComments = addslashes ($_POST['comments']); $sReason = addslashes ($_POST['Reason']); $sDateStarted = addslashes ($_POST['DateStarted']); } else { $sMedName = $_POST['MedName']; $sTakeNumber = $_POST['TakeNumber']; $sMedForm = $_POST['MedForm']; $sRoute = $_POST['Route']; $sTimesPerDay = $_POST['TimesPerDay']; $sRefills = $_POST['Refills']; $sNumberOfDays = $_POST['NumberOfDays']; $sUsage = $_POST['Usage']; $sComments = $_POST['comments']; $sReason = $_POST['Reason']; $sDateStarted = $_POST['DateStarted']; } session_start(); $RecordId = $_SESSION['record_id']; $sClient = clear_xss($_POST['client_id']); $sCurrent = 'Yes'; $rStory = mysql_query("INSERT INTO medications (client_id, MedName, Reason, DateStarted, Usage, current, comments, Refills, TakeNumber, NumberOfDays, MedForm, TimesPerDay, Route, input_by, RecordId) VALUES ('$iSenderID', 'sMedName', 'sReason', 'sDateStarted', 'sUsage', 'sCurrent', 'sComments', 'sRefills', 'sTakeNumber', 'sNumberOfDays', 'sMedForm', 'sTimesPerDay', 'sRoute', '$iSenderID', '$RecordId')"); }
Any help resolving this would be greatly appreciated. Thanks in advance.
caredesign.net |
I have spent most of the night and this morning trying to get this darned date field to work properly. It is puzzling me because I have this field working on other pages, and I tried to do the same on this popup but things are not working.
Above I posted the code for the actual php page. Here is the code for the html page that goes with it:
<script> $(function() { $( "#datepicker" ).datepicker(); }); </script> <div class="disignBoxFirst bx-def-border"> <div class="boxFirstHeader bx-def-bh-margin">__title__<div class="dbTopMenu"><a href="page/myneeds-complete-medications" onClick="CloseAndRefresh(); return:false;">Close</a></div></div> <div class="boxContent"> __content__ </div> </div>
Also, looking at the ones that work, I made a change to my previous posted code:
'DateStarted' => array( 'type' => 'text', 'name' => 'DateStarted', 'attrs' =>array ( 'id' => 'datepicker', ), 'caption' => _t("When did you start taking the medicine? (Approximate dates are fine)"), ),
the section in red I originally had date as the type, but looking at one that works, I have text.
caredesign.net |
Silly question but did you do a firebug inspection of the pop-up form to see what is actually in the code of the form as output by the form thingy? Geeks, making the world a better place |
yes I did. This is the working one:
<label for="AdmissionDate">
Admission Date:
</label> <input id="datepicker" class="hasDatepicker" type="text" value="09/18/2013" onchange="this.form.submit();" name="AdmissionDate"></input>
this is the non working one:
<tr>
<td class="caption"> … </td> <td class="value"> <div class="clear_both"></div> <div class="input_wrapper input_wrapper_text bx-def-round-corners-with-border"> <input id="datepicker" class="form_input_text bx-def-font" type="text" name="DateStarted"></input> </div> <i class="warn sys-icon exclamation-sign" float_info=" "></i> <div class="clear_both"></div> </td>
</tr>
For some reason, the one that is not working is missing the item in red that the working one has, which leads me to believe that the javascript function is not being called properly. I do see this above the form in the non working one:
<script>
$(function() { $( "#datepicker" ).datepicker(); });
</script>
but not the part that calls the actual jquery page (<script type="text/javascript" language="JavaScript" src="plugins/jquery/jquery.ui.datepicker.min.js"></script>)
I have tried putting this in several places, and none of which are working.
caredesign.net |
here is the url for the page I am trying to get to work - its on a test site and is not an adult site, so no worries there. http://mytherapysession.com/mtsdemo/page/myneeds-complete-medications
if you click Add Current Medications, this is the link I am having an issue with. I also noticed with my current code, I have to click multiple times on the link before it opens up. As if it is looking for something and can not find it.
caredesign.net |
the function is looking for the id; however, my guess is that the class is important to show the calendar? Geeks, making the world a better place |
'DateStarted' => array( 'type' => 'text', 'name' => 'DateStarted', 'attrs' =>array ( 'id' => 'datepicker', ), 'caption' => _t("When did you start taking the medicine? (Approximate dates are fine)"), ),
Do you need to add the class here in the attrs?
Geeks, making the world a better place |
i added the class to the attrs and it still does not work - I am totally stumped caredesign.net |
I won't be of much help most likley. I rarely use dolphins form generator. i don't develop many mods that do. Just the settings form which dolphin handles differently.
Anyhoo. Your going to need to turn off js caching. It's preventing me from seeing all the JS.
However you do have a problem. A couple of problems actually.
1) You seem to be loading some things twice on the page. View page source in browser and search for jquery. You will see some items being repeated. And for jquery that is a bad thing.
2) Your form is not currently popping up at all now. But when it was working there was a javascript error datepicker not defined. Which was occurring on first click which is what preventing it from popping up and required the second click.
Only time i have used the datepicker in dolphin was in my own form i did by hand, and i used jquerys examples. Dolphin does not do it exactly the same way. https://www.deanbassett.com |
I have been constantly playing with it trying to get things to work. I have gone back to the bare minimum and it is loading on first click, but still no date popup. The other pages I used with the datepicker were done differently because we did not like the formatting of the 2 columns, but looking at things now on different devices, the 2 columns is not really bad at all. caredesign.net |
You need to turn off all of dolphins caching. I can't tell if jquery.ui.datepicker.min.js is getting inserted. I don't see it.
And change the ID of that form field to something else. Dolphin normally uses DP######## where ######## is some random number. The rest of the field itself looks fine. The problem is the javascript error datepicker is not a function that needs to be resolved.
https://www.deanbassett.com |
Yea. I rarely use dolphins form generator. I find it far easier to create a form myself in a template and just pass the values to it that i need to be dynamic when i pass the template to the template parser.
https://www.deanbassett.com |
al caches turned off. I see the error where the function is not defined. I have tried placing it in several different places, but to no avail.
And for consistency, all other forms give the message after submission that everything was done - so trying to keep that same functionality. If I did a form like I normally would, I would lose that, and then I would have to go back and redo all the other umpteen forms i have in the site to make those sconsistant
caredesign.net |
Yea, the datepicker js is not shoing up anywhere in the page.
Start by changing the form type from text to date. It needs to be set to date so dolphin changes it to the type date-calender which the datepicker needs. If it is set to date, dolphin should insert the datepicker js automatically and it would not need to be specified. Or at least in theory.
https://www.deanbassett.com |
OK, I managed to get all the jquery stuff to finally show up in firebug. I reduced my form for ease of posting here. In my popup.php page, I have:
<?php
require_once('inc/header.inc.php'); require_once(BX_DIRECTORY_PATH_INC . 'design.inc.php'); require_once(BX_DIRECTORY_PATH_INC . 'profiles.inc.php'); require_once(BX_DIRECTORY_PATH_INC . 'utils.inc.php');
bx_import('BxTemplFormView'); // --------------- page variables and login $_page['name_index'] = 29; $_page['css_name'] = array('forms_adv.css'); $_page['header'] = _t("Add Current Medications"); $_page['header_text'] = _t("Add Current Medications"); $profileID = 0; if( isset($_GET['ID']) ) { $profileID = (int) $_GET['ID']; } else if( isset($_POST['ID']) ) { $profileID = (int) $_POST['ID']; }
$iSenderID = getLoggedId(); $aSenderInfo = getProfileInfo($iSenderID);
// --------------- page components
$sCaption = ($profileID) ? _t('Please use this form to input any type of Medications you are currently taking.', $site['title']) : _t('Please use this form to input any type of Medications you are currently taking.', $site['title']);
$aForm = array( 'form_attrs' => array( 'id' => 'add_current_medications', 'name' => 'add_current_medications', 'action' => BX_DOL_URL_ROOT . 'current-medications-add.php', 'method' => 'post', 'onsubmit' => "return bx_ajax_form_check(this)", ), 'params' => array ( 'db' => array( 'submit_name' => 'do_submit', // we need alternative hidden field name here, instead of submit, becuase AJAX submit doesn't pass submit button value ), ), 'inputs' => array ( 'header1' => array( 'type' => 'block_header', 'caption' => $sCaption, ), 'do_submit' => array( 'type' => 'hidden', 'name' => 'do_submit', // hidden submit field for AJAX submit 'value' => 1, ), 'id' => array( 'type' => 'hidden', 'name' => 'ID', 'value' => $profileID, ), 'DateStarted' => array( 'type' => 'text', 'name' => 'DateStarted', 'attrs' => array ( 'id' => 'datepicker', 'readonly' => 'Yes', ), 'caption' => _t("When did you start taking the medicine? (Approximate dates are fine)"), ), 'submit_send' => array( 'type' => 'submit', 'name' => 'submit_send', 'value' => _t("Add Medications"), ), ) );
// generate form or form result content $oForm = new BxTemplFormView($aForm); $oForm->initChecker(); if ($oForm->isSubmittedAndValid()) { $s = SubmitMedications($iSenderID) ? _t("Medications Input Success") : _t("Medications Input Fail"); $sPageCode = MsgBox(_t($s)); } else { $sPageCode = $oForm->getCode(); }
// output AJAX form submission result if (bx_get('BxAjaxSubmit')) { header('Content-type:text/html;charset=utf-8'); echo $sPageCode; exit; }
$sPageCode = $GLOBALS['oSysTemplate']->parseHtmlByName('default_margin.html', array('content' => $sPageCode));
// output ajax popup if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') { $aVarsPopup = array ( 'title' => $_page['header'], 'content' => $sPageCode, ); header('Content-type:text/html;charset=utf-8'); echo $GLOBALS['oFunctions']->transBox($GLOBALS['oSysTemplate']->parseHtmlByName('popup_mncomp_medications.html', $aVarsPopup), true); exit; }
// output regular page $_ni = $_page['name_index']; $_page_cont[$_ni]['page_code'] = $sPageCode; PageCode();
// --------------- page components functions
function SubmitMedications($iSenderID = 0) { global $profileID; if(! get_magic_quotes_gpc() ) { $sMedName = addslashes ($_POST['MedName']); $sTakeNumber = addslashes ($_POST['TakeNumber']); $sMedForm = addslashes ($_POST['MedForm']); $sRoute = addslashes ($_POST['Route']); $sTimesPerDay = addslashes ($_POST['TimesPerDay']); $sNumberOfDays = addslashes ($_POST['NumberOfDays']); $sRefills = addslashes ($_POST['Refills']); $sUsage = addslashes ($_POST['Usage']); $sComments = addslashes ($_POST['comments']); $sReason = addslashes ($_POST['Reason']); $sDateStarted = addslashes ($_POST['DateStarted']); } else { $sMedName = $_POST['MedName']; $sTakeNumber = $_POST['TakeNumber']; $sMedForm = $_POST['MedForm']; $sRoute = $_POST['Route']; $sTimesPerDay = $_POST['TimesPerDay']; $sRefills = $_POST['Refills']; $sNumberOfDays = $_POST['NumberOfDays']; $sUsage = $_POST['Usage']; $sComments = $_POST['comments']; $sReason = $_POST['Reason']; $sDateStarted = $_POST['DateStarted']; } session_start(); $RecordId = $_SESSION['record_id']; $sClient = clear_xss($_POST['client_id']); $sCurrent = 'Yes'; $rStory = mysql_query("INSERT INTO medications (client_id, MedName, Reason, DateStarted, Usage, current, comments, Refills, TakeNumber, NumberOfDays, MedForm, TimesPerDay, Route, input_by, RecordId) VALUES ('$iSenderID', 'sMedName', 'sReason', 'sDateStarted', 'sUsage', 'sCurrent', 'sComments', 'sRefills', 'sTakeNumber', 'sNumberOfDays', 'sMedForm', 'sTimesPerDay', 'sRoute', '$iSenderID', '$RecordId')"); }
in the popup.html page i have:
<link rel="stylesheet" href="http://mytherapysession.com/mtsdemo/plugins/jquery/themes/jquery-ui-1.8.4.custom.css" /> <script type="text/javascript" language="JavaScript" src="http://mytherapysession.com/mtsdemo/plugins/jquery/jquery.ui.datepicker.min.js"></script> <script type="text/javascript" language="javascript"> $(function() { $( "#datepicker" ).datepicker(); }); </script> <div class="disignBoxFirst bx-def-border"> <div class="boxFirstHeader bx-def-bh-margin">__title__<div class="dbTopMenu"><a href="page/myneeds-complete-medications" onClick="CloseAndRefresh(); return:false;">Close</a></div></div> <div class="boxContent"> __content__ </div> </div>
I am now getting a totally different error, so hoping ZI am working in the correct direction:
[14:58:27.641] TypeError: t(...).zIndex is not a function @ http://mytherapysession.com/mtsdemo/plugins/jquery/jquery.js:7
caredesign.net |
@deano, I get the above error whether I use date or text for the type. caredesign.net |
When i view the page source i still do not see jquery.ui.datepicker.min.js anywhere in the source.
I am lost on this one. I have no clue where your problems are.
As far as i am concerned, No js should be put into the popup. That's bad programming. All of that should be on the main page that calls the popup.
But because i cannot see the datepicker js when i view the source, but you say you can then i am at a loss. I don't know what else to do.
https://www.deanbassett.com |
I made afew changes - from what I noticed, the issue is with the 'id' attribute.
I put this in my _header.html page, cause I also noticed that the datepicker is not called at all, so that tells me something has to call it:
<script type="text/javascript" language="JavaScript" src="http://mytherapysession.com/mtsdemo/plugins/jquery/jquery.ui.datepicker.min.js"></script>
this gets it to show up when looking through firebug, Then I kept this on the popup.html page:
<script type="text/javascript" language="javascript"> $(function() { $( "#testdate" ).datepicker(); }); </script>
with those 2 changes alone, I get no errors regarding the field.
Now, with my field like this:
'DateStarted' => array( 'type' => 'text', 'name' => 'DateStarted', 'attrs_wrapper' => array ( 'id' => 'testdate', 'readonly' => 'Yes', ), 'caption' => _t("When did you start taking the medicine? (Approximate dates are fine)"), ),
see image below for results:
but if I remove the id from the atttributes, I get nothing at all.
caredesign.net |
It's the way your using the datepicker which is not how dolphin does it.
Your specifically setting it with this
$(function() { $( "#testdate" ).datepicker(); });
Which ties it to the #testdate id.
For dolphins built in method to work. the field must be of type date. Not text, This is because dolphin ties it to the date-calender type and not to a id and besides the datepicker js i also think dolphins jquery.webforms has to be there as well. But if it's working with your id set, then it does not matter.
https://www.deanbassett.com |
OK, I went back to the beginning and all I have is this on my form:
'DateStarted' => array( 'type' => 'date', 'name' => 'DateStarted', 'caption' => _t("When did you start taking the medicine? (Approximate dates are fine)"), ),
Now, from my understanding, this alone should bring up the calendar - but it does not. I had this problem a while back with 2 other forms. One form I have like this, and the datepicker works:
<td class="value"> <div class="clear_both"></div> <div class="input_wrapper input_wrapper_date bx-def-round-corners-with-border"> <input class="form_input_date bx-def-font" name="DateOfBirth" value="<?php echo $DateOfBirth ?>" type="date_calendar"> </div> <i class="warn sys-icon exclamation-sign" float_info=" "></i> <div class="clear_both"></div> </td>
and the other form I have this:
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> <script> $(function() { $( "#datepicker" ).datepicker(); }); </script>
<form name="admission" method="post" action="UpdateAdmission.php?client=<?php echo $client ?>"> <label for="AdmissionDate">Admission Date:</label> <input name="AdmissionDate" type="text" id="datepicker" onChange="this.form.submit();" value="<?php echo $AdmissionDate ?>"> </form>
Both of these forms are php blocks on a page that I created from scratch using the BxDolPageView.php template and I have this on that page:
$_page['css_name'] = 'demo_table.css'; $_page['extra_css'] .= $site['plugins'] . 'jquery/themes/jquery-ui-1.8.4.custom.css'; $_page['extra_js'] .= '<script type="text/javascript" language="JavaScript" src="plugins/jquery/jquery.ui.datepicker.min.js"></script>';
caredesign.net |
Well one of the problems i see with that code is this.
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> <script> $(function() { $( "#datepicker" ).datepicker(); }); </script>
That includes a copy of jquery which dolphin already includes which will cause conflicts, it also binds the date picker to the id of datepicker.
So remove that, then make sure both plugins/jquery/jquery.ui.datepicker.min.js and inc/js/jquery.webForms.js show up in the source when you view it. If not then they will need to be added. https://www.deanbassett.com |
But you changed the form type back to text again.
If your not going to wait for my suggestions before you start changing things again, then i cannot help you.
I am done for the night anyway. So your on your own with this.
https://www.deanbassett.com |
Well one of the problems i see with that code is this.
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> <script> $(function() { $( "#datepicker" ).datepicker(); }); </script>
That includes a copy of jquery which dolphin already includes which will cause conflicts, it also binds the date picker to the id of datepicker.
So remove that, then make sure both plugins/jquery/jquery.ui.datepicker.min.js and inc/js/jquery.webForms.js show up in the source when you view it. If not then they will need to be added.
If I remove that, then it does not work. On that form, things are working perfectly. On my new form it isnt working with or without it. The only thing I can think of that makes any sense is that there is possibly a bug when creating forms with a datepicker. Cause I agree with you, I should not have to add the call for the javascript form because it should already be in Dolphin. I also had this problem with JQuery tables. IU had to make my own call to them instead of Dolphin doing it automatically. I have to put this on each page that I want to have a datatable on:
<link type="text/css" rel="stylesheet" href="http://mytherapysession.com/mtsdemo/templates/base/demo_page.css"></link> <link type="text/css" rel="stylesheet" href="http://mytherapysession.com/mtsdemo/templates/base/demo_table.css"></link> <link type="text/css" rel="stylesheet" href="http://mytherapysession.com/mtsdemo/templates/base/jquery.dataTables_themeroller.css"></link> <link type="text/css" rel="stylesheet" href="http://mytherapysession.com/mtsdemo/plugins/jquery/themes/jquery-ui-1.8.4.custom.css"></link>
<script src="http://mytherapysession.com/mtsdemo/inc/js/jquery.dataTables.js" language="JavaScript" type="text/javascript"></script>
<script type="text/javascript"> $(document).ready(function() { $('#current_meds').dataTable( { "bJQueryUI": true, "bPaginate": false, "bLengthChange": false, "bFilter": false, "bSort": false, "bInfo": false, "bAutoWidth": true } ); } ); </script>
caredesign.net |
The problem your running into is your trying to mix the way dolphin handles the datepicker with the method jquery provides on it's website.
You need to pick one method or the other.
The jquery way binds the datepicker to a ID. Dolphin binds it to a type.
Anyhow, the jquery way is easier, in which case you just take out that extra jquery.js line but leave the binding in and make sure you set the ID attribute of your form field to the same id used for the binding and set the type to text.
The dolphin way is different. It does not require a ID, the binding you added needs to be removed, and the type must be set to date, and the page must include the webforms.js from the inc/js folder.
Mix the two methods, it may not work. Include multiple copies of any js file it may not work.
I am out of time for the night.
https://www.deanbassett.com |
well, i went through and tried everything I could, and have put things back to how I originally had them. I am inclined to think that this whole datepicker deal is not so much about the coding, but the fact that it is in a popup. I have used the other two codes that I know work in a php block on a page, but they do not work in a popup either. Hopefully Alex or someone can chime in and tell me what the real deal is. Thanks for your time and effort Deano. caredesign.net |
I am getting feedback that most don't like the calendar thing and instead just want boxes, either type in or dropdown Geeks, making the world a better place |
i thought that separate fields would make things easier and beter, but in actual usage of the system, everyone prefers the datepicker calendar. As most will be on mobile devices (most specifically the ipad mini), it is easier to use the calendar than typing in each field value. And since Dolphin came with a bunch of functionality that we were looking for in a time crunch, we have stuck with it. Now through actual usage and recommendations from other professionals, I am working on making everything consistent, thus why I have been trying so hard to figure this datepicker deal out (there are a few different places where a date is input, and to maintain consistency, this one page is the last one that it is not working on. I even looked at the Events module, and can find no real difference in forms, which leads me to believe that maybe it has something to do with the popup. I am curently using the showanyhtml function for the popup. I will try changing it to return !loadDynamicPopupBlock tomorrow. I tried a little today, but it wasnt opening in a popup, so I have to search through another test site to find where I used it and how I got it working before. My only 2 guesses are A - there is a glitch when using the datepicker in a popup, or I am using the wrong type of popup. caredesign.net |
Still at a loss whether it is possible to use the default Dolphin coding for datepicker in a popup. Was hoping AlexT would have commented, so I will wait a little longer and keep my fingers crossed. caredesign.net |
bumping this in case someone can give any added assistance. caredesign.net |
You need to call the following after inserting ajax content:
$('here is selector for content loaded using AJAX').addWebForms()
Usually this functional is called automatically when AJAX content is loaded using getHtmlData function, but it looks like you are using some different method, like loading AJAX content using jQuery methods.
Rules → http://www.boonex.com/terms |
thank you so much for your reply, AlexT - unfortunately, I have no clue how to do what you suggested. caredesign.net |
It is great to see a developer help someone but in this case this is NOT about Dolphin but about custom code; I am going to expand on this in a separate topic. Geeks, making the world a better place |
the original code came from the tellfriend.php page, I just modified it - instead of sending an email, enter data into database. caredesign.net |
the original code came from the tellfriend.php page, I just modified it - instead of sending an email, enter data into database.
Yes, that may be so but my statement about helping with custom code while ignoring bug reports and issues with core Dolphin applications still stands.
Geeks, making the world a better place |
You need to do it in callback function, here is an example:
$.get( "url-to-get-html-with-form", function(data) {
$('.result').html(data);
$('.result').addWebForms();
});
thank you so much for your reply, AlexT - unfortunately, I have no clue how to do what you suggested.
Rules → http://www.boonex.com/terms |