87 $FORM_VALIDATION_ERROR =
"";
88 $JSON_FormFields =
"";
89 $core_values_array =
"";
90 $l_ShowDisclosure =
false;
91 $l_ShowSecurity =
false;
94 $loadedValues[
'lnappentry'] = Array();
95 $loadFields = Array(
"btnFormPost" => array(
'filter' => FILTER_SANITIZE_STRING),
96 "btnFormDisclosure" => array(
'filter' => FILTER_SANITIZE_STRING),
97 "btnSubmitNow" => array(
'filter' => FILTER_SANITIZE_STRING),
98 "btnFinishLater" => array(
'filter' => FILTER_SANITIZE_STRING),
99 "loanid" => array(
'filter' => FILTER_SANITIZE_NUMBER_INT),
100 "respid" => array(
'filter' => FILTER_SANITIZE_NUMBER_INT),
101 "new" => array(
'filter' => FILTER_SANITIZE_NUMBER_INT),
102 "load" => array(
'filter' => FILTER_SANITIZE_NUMBER_INT),
103 "confid" =>array(
'filter' => FILTER_SANITIZE_STRING)
105 HCU_ImportVars($loadedValues,
"lnappentry", $loadFields);
107 $Cu = $HB_ENV[
'Cu'] ??
'';
119 $coreAutoFillFormat = Array(
"AccountNumber" => Array(
'format' =>
'none',
'mir_key' =>
'accountnumber'),
120 "FirstName" => Array(
'format' =>
'none',
'mir_key' =>
'firstname'),
121 "MiddleName" => Array(
'format' =>
'none',
'mir_key' =>
'middlename'),
122 "LastName" => Array(
'format' =>
'none',
'mir_key' =>
'lastname'),
123 "Email" => Array(
'format' =>
'none',
'mir_key' =>
'email'),
124 "HomePhone" => Array(
'format' =>
'phone',
'mir_key' =>
'homephone'),
125 "WorkPhone" => Array(
'format' =>
'phone',
'mir_key' =>
'workphone'),
126 "CellPhone" => Array(
'format' =>
'phone',
'mir_key' =>
'cellphone'),
127 "Fax" => Array(
'format' =>
'phone',
'mir_key' =>
'fax'),
128 "SSN" => Array(
'format' =>
'ssn',
'mir_key' =>
'ssn'),
129 "Address1" => Array(
'format' =>
'none',
'mir_key' =>
'address1'),
130 "Address2" => Array(
'format' =>
'none',
'mir_key' =>
'address2'),
131 "City" => Array(
'format' =>
'none',
'mir_key' =>
'city'),
132 "State" => Array(
'format' =>
'none',
'mir_key' =>
'state'),
133 "Zip" => Array(
'format' =>
'zip',
'mir_key' =>
'zip'),
134 "CC" => Array(
'format' =>
'none',
'mir_key' =>
'cc'),
135 "DOB" => Array(
'format' =>
'date',
'mir_key' =>
'dob'));
138 $coreAutoFillInfo = Array();
139 $defaultItemsFromCore =
false;
140 $valuesItemsFromCore = Array();
143 $App_Confirm =
false;
144 $setInputMaskEntry =
'';
145 $setExtraValidityCmds =
'';
146 if (HCU_array_key_exists(
'load', $loadedValues[
'lnappentry'])) {
147 $loadLoanId = intval($loadedValues[
'lnappentry'][
'load']);
150 FROM {$DB_TABLE_PREFIX}userresponse 151 WHERE respid = " . $loadLoanId .
" 152 AND userid = " . intval($DMSAPP_CURRENTUSERID);
154 $app_rs = db_query($sql, $dbh);
155 $app_row = db_fetch_assoc($app_rs);
158 $Master_LoanID = $app_row[
'loanid'];
159 $App_RespID = $app_row[
'respid'];
161 if ($app_row[
'respsubmiton'] !=
'') {
162 $FORM_VALIDATION_ERROR =
"<li>The loan you are trying to edit was submitted on {$app_row['respsubmiton']} and may not be modified.</li>";
171 if (HCU_array_key_exists(
'confid', $loadedValues[
'lnappentry'])) {
172 $l_cookiename = ReturnDeviceCookieName($DMSAPP_CURRENTCUCODE, $DMSAPP_LOGINTYPE, $DMSAPP_CURRENTEMAIL, $DMSAPP_CURRENTUSERID);
174 $l_cookieval = $_COOKIE[$l_cookiename];
177 $RecordVal = sha1($DMSAPP_SECRET_KEY . trim($app_row[
'respssn']) . date(
'mdY', strtotime($app_row[
'respdob'])) . $l_cookieval);
179 if (crypt($RecordVal, $loadedValues[
'lnappentry'][
'confid']) == $loadedValues[
'lnappentry'][
'confid']) {
184 $FORM_VALIDATION_ERROR =
"<li>The answers you provided did not match with what we have on file for this loan. Please try again.</li>";
192 $lnapp_security_return_form_code = $form_code;
193 $lnapp_security_params =
"load=" . $loadLoanId;
194 $lnapp_security_respid =
"";
197 include_once($inc_path .
"lnappsecurity.i");
201 $(document).ready(
function() {
202 $(
'#body-wrapper').addClass(
'no-show-menu');
206 $l_ShowSecurity =
true;
211 $FORM_VALIDATION_ERROR =
"<li>The loan you are trying to load was not found.</li>";
213 }
else if (HCU_array_key_exists(
'new', $loadedValues[
'lnappentry'])) {
217 if (HCU_array_key_exists(
'btnFormDisclosure', $loadedValues[
'lnappentry']) !=
'entry') {
218 $lnapp_disclosure_loanid = intval($loadedValues[
'lnappentry'][
'new']);
219 include_once($inc_path .
"lnappdisclosure.i");
223 if (isset($lnapp_disclosure_display)) {
224 $l_ShowDisclosure = $lnapp_disclosure_display;
225 if ($l_ShowDisclosure) {
229 $(document).ready(
function() {
230 $(
'#body-wrapper').addClass(
'no-show-menu');
239 $Master_LoanID = intval($loadedValues[
'lnappentry'][
'new']);
240 }
else if (HCU_array_key_exists(
'btnFormPost', $loadedValues[
'lnappentry'])) {
242 $Master_LoanID = intval(HCU_array_key_value(
'loanid', $loadedValues[
'lnappentry']));
243 $App_RespID = intval(HCU_array_key_value(
'respid', $loadedValues[
'lnappentry']));
248 $App_SchemaDetail = Array();
249 $App_SchemaFields = Array();
250 $App_AnswerDetail = Array();
251 $App_ConditionalFields = Array();
253 if (!$l_ShowDisclosure && !$l_ShowSecurity) {
255 if ($Master_LoanID > 0) {
256 $sql =
"SELECT schemadetail.* 257 FROM {$DB_TABLE_PREFIX}schemadetail as schemadetail 258 JOIN {$DB_TABLE_PREFIX}schemamaster as schemamaster ON 259 schemamaster.loanid = schemadetail.loanid 260 WHERE schemadetail.loanid = " . intval($Master_LoanID) .
" 261 AND schemamaster.cu = '$DMSAPP_CURRENTCUCODE' 262 ORDER BY schemadetail.loanid, schemadetail.pageid, schemadetail.groupid, schemadetail.lineid 264 $loan_rs = db_query($sql, $dbh);
267 if ($loan_rs && db_num_rows($loan_rs) > 0) {
269 while ($loan_row = db_fetch_assoc($loan_rs, $loan_idx++)) {
272 $App_SchemaDetail[$loan_row[
'detailid']] = $loan_row;
275 if (strpos(
":YNR:YNR01:YNS:YNS01:GN:GA:GT:AS:AR:",
":" . trim($loan_row[
'fieldtype']) .
":") !==
false) {
279 $fieldname =
"formfield_" . $loan_row[
'detailid'];
280 $App_SchemaFields[$fieldname] =
"";
284 if (isset($_POST[
'btnFormPost'])) {
285 $fieldattr = json_decode($App_SchemaDetail[$loan_row[
'detailid']][
'fieldattr'],
true);
286 if (HCU_array_key_value(
'validation_conditionname', $fieldattr) !=
'') {
289 if (HCU_array_key_exists($fieldname, $_POST)) {
290 $App_ConditionalFields[$fieldattr[
'validation_conditionname']] = trim($_POST[$fieldname]);
296 } elseif ($FORM_VALIDATION_ERROR !=
'') {
299 throw new Exception (
"A problem was encountered that is preventing the loan application from loading.");
302 throw new Exception (
"A loan matching the specified criteria was not found.");
306 if (isset($_POST[
'btnFormPost'])) {
314 if (!HCU_array_key_value(
'cookieval_' . intval($_COOKIE[
'ENTRYCOOKIE']), $_POST) ==
"SET") {
315 $FORM_VALIDATION_ERROR =
"<li>Unable to process request. Do not use F5 or reload screen. Use the buttons provided on the bottom of the application</li>.";
322 $Custom_Resp_Field = Array();
325 if ($FORM_VALIDATION_ERROR ==
"") {
328 $FormPopulate = array();
329 foreach ($App_SchemaFields as $fields_key=>$fields_value) {
331 $field_detailid = substr($fields_key, strlen(
"formfield_") );
333 $fieldattr = json_decode($App_SchemaDetail[$field_detailid][
'fieldattr'],
true);
335 $fieldval = trim(HCU_array_key_value($fields_key, $_POST));
341 if ($fieldval ==
'%timestamp%') {
342 $fieldval = date(
'm/d/Y');
345 if ((isset($_POST[
'btnFormPost']) && $_POST[
'btnFormPost'] ==
'Submit') || isset($_POST[
'btnFormPost']) && $_POST[
'btnFormPost'] ==
'Save') {
346 if (isset($fieldattr[
'validation_require']) && $fieldval ==
'' && (intval(HCU_array_key_value(
'hidden', $fieldattr)) != 1)) {
347 if (($_POST[
'btnFormPost'] ==
'Submit' && $fieldattr[
'validation_require'] > 0) || ($_POST[
'btnFormPost'] ==
'Save' && $fieldattr[
'validation_require'] == 2)) {
349 if (HCU_array_key_exists(
'validation_require_conditional',$fieldattr)) {
350 if ($fieldattr[
'validation_require_conditional'] !=
'') {
354 if (isset($fieldattr[
'validation_require_conditional'][
'field']) && isset($fieldattr[
'validation_require_conditional'][
'value'])) {
356 if (HCU_array_key_value($fieldattr[
'validation_require_conditional'][
'field'], $App_ConditionalFields) == trim($fieldattr[
'validation_require_conditional'][
'value']) && $fieldval ==
'') {
357 $FORM_VALIDATION_ERROR .=
"<li>" . $App_SchemaDetail[$field_detailid][
'fieldvalue'] .
" is a required field to submit this application.</li>";
362 $FORM_VALIDATION_ERROR .=
"<li>" . $App_SchemaDetail[$field_detailid][
'fieldvalue'] .
" is a required field to submit this application.</li>";
371 if (strlen($fieldval) > 0) {
375 switch ($App_SchemaDetail[$field_detailid][
'fieldtype']) {
380 if (!strstr(
":Y:N:", $fieldval) && $fieldval !=
"") {
381 $FORM_VALIDATION_ERROR .=
"<li>" . $App_SchemaDetail[$field_detailid][
'fieldvalue'] .
" contains an invalid option.</li>";
388 if (!strstr(
":1:0:", $fieldval) && $fieldval !=
"") {
389 $FORM_VALIDATION_ERROR .=
"<li>" . $App_SchemaDetail[$field_detailid][
'fieldvalue'] .
" contains an invalid option.</li>";
408 if (isset($fieldattr[
'validation_match'])) {
409 switch ($fieldattr[
'validation_match']) {
412 if (!(validateDate($fieldval) || preg_match(
'/^((0?\d)|(1[012]))\/([012]?\d|30|31)\/\d{4}$/', $fieldval))) {
413 $FORM_VALIDATION_ERROR .=
"<li>" . $App_SchemaDetail[$field_detailid][
'fieldvalue'] .
" is not a valid date ##/##/####.</li>";
417 if (!preg_match(
'/^[\d]{3}-[\d]{2}-[\d]{4}$/', $fieldval)) {
418 $FORM_VALIDATION_ERROR .=
"<li>" . $App_SchemaDetail[$field_detailid][
'fieldvalue'] .
" is not a valid ssn ###-##-####.</li>";
422 if (!preg_match(
'/\d{3}[-\s.]\d{3}[-\s.]\d{4}/x', $fieldval)) {
423 $FORM_VALIDATION_ERROR .=
"<li>" . $App_SchemaDetail[$field_detailid][
'fieldvalue'] .
" is not a valid phone ###-###-####.</li>";
430 if (!validateEmail($fieldval)) {
431 $FORM_VALIDATION_ERROR .=
"<li>" . $App_SchemaDetail[$field_detailid][
'fieldvalue'] .
" is not a valid email.</li>";
436 if (!preg_match(
'/^\$?((\d{1,3}(,\d{3})*)|\d+)(\.(\d{2})?)?$/', $fieldval)) {
437 $FORM_VALIDATION_ERROR .=
"<li>" . $App_SchemaDetail[$field_detailid][
'fieldvalue'] .
" is not a valid dollar amount.</li>";
440 $FORM_VALIDATION_ERROR .= ValidateRange($App_SchemaDetail[$field_detailid][
'fieldvalue'], $fieldattr, $fieldval);
445 if (!is_numeric($fieldval)) {
446 $FORM_VALIDATION_ERROR .=
"<li>" . $App_SchemaDetail[$field_detailid][
'fieldvalue'] .
" is not a valid integer.</li>";
450 if (!preg_match(
'/^([1-9][0-9]*|0)(\.[0-9]{2})?$/', $fieldval)) {
451 $FORM_VALIDATION_ERROR .=
"<li>" . $App_SchemaDetail[$field_detailid][
'fieldvalue'] .
" is not a valid number.</li>";
454 $FORM_VALIDATION_ERROR .= ValidateRange($App_SchemaDetail[$field_detailid][
'fieldvalue'], $fieldattr, $fieldval);
468 if (isset($fieldattr[
'maxlength'])) {
469 if (strlen($fieldval) > intval($fieldattr[
'maxlength']) && intval($fieldattr[
'maxlength']) > 0) {
470 $FORM_VALIDATION_ERROR .=
"<li>" . $App_SchemaDetail[$field_detailid][
'fieldvalue'] .
" has exceeded the max length of " . intval($fieldattr[
'maxlength']) .
".</li>";
479 if (HCU_array_key_value(
'responsetablefield', $fieldattr) !=
'') {
480 $Custom_Resp_Field[$fieldattr[
'responsetablefield']] = $fieldval;
482 if (stripos(
':P:H:L:',
':' . $App_SchemaDetail[$field_detailid][
'fieldtype'].
':') ===
false) {
483 $App_SchemaFields[$fields_key] = $fieldval;
493 $FormPopulate[$fields_key] = $fieldval;
496 $JSON_FormPopulate = json_encode($FormPopulate);
503 $JSON_FormFields = json_encode($App_SchemaFields);
504 if ($FORM_VALIDATION_ERROR ==
"") {
505 if (intval($_POST[
'respid']) >= 0) {
507 $sql =
"UPDATE {$DB_TABLE_PREFIX}userresponse 509 respamt = " . number_format(FormatDateForSubmit($Custom_Resp_Field[
'respamt'],
"usd"), 2,
".",
"") .
", 511 respmodifiedon = now(), 512 resplname = '". save_text(HCU_array_key_value(
'resplname', $Custom_Resp_Field), 55) .
"', 513 respfname = '". save_text(HCU_array_key_value(
'respfname', $Custom_Resp_Field), 25) .
"', 514 respmname = '". save_text(HCU_array_key_value(
'respmname', $Custom_Resp_Field), 25) .
"', 515 respssn = '". save_text(HCU_array_key_value(
'respssn', $Custom_Resp_Field), 11) .
"', 516 respdob = '". save_text(HCU_array_key_value(
'respdob', $Custom_Resp_Field), 10) .
"', 517 respmember = '". save_text(HCU_array_key_value(
'respmember', $Custom_Resp_Field), 15) .
"', 518 respphone = '". save_text(HCU_array_key_value(
'respphone', $Custom_Resp_Field), 15) .
"', 519 respapplication = '". save_text($JSON_FormFields) .
"' 520 WHERE respid = " . intval($_POST[
'respid']) .
" 521 AND userid = " . intval($DMSAPP_CURRENTUSERID);
523 $response_id = intval($_POST[
'respid']);
527 $sql =
"SELECT nextval('{$DB_TABLE_PREFIX}userresponse_respid_seq'::text) as responseid ";
528 $id_rs = db_query($sql, $dbh);
529 list($response_id) = db_fetch_array($id_rs);
530 db_free_result($id_rs);
533 $sql_respstatus =
"0";
534 $sql =
"INSERT INTO {$DB_TABLE_PREFIX}userresponse 535 (respid, userid, loanid, respstatus, respamt, 536 respcomments, respcoreloanappid, respstarton, respsubmiton, 537 respmodifiedon, resplname, respfname, respmname, respssn, 538 respdob, respmember, respphone, respapplication) 540 ($response_id, $DMSAPP_CURRENTUSERID, $Master_LoanID, $sql_respstatus, " . number_format(FormatDateForSubmit(HCU_array_key_value(
'respamt', $Custom_Resp_Field),
"usd"),2,
".",
"") .
", 541 '', -1, now(), null, null, '". save_text(HCU_array_key_value(
'resplname', $Custom_Resp_Field), 55) .
"', '" . save_text(HCU_array_key_value(
'respfname', $Custom_Resp_Field), 25) .
"', 542 '". save_text(HCU_array_key_value(
'respmname', $Custom_Resp_Field), 25) .
"', '". save_text(HCU_array_key_value(
'respssn', $Custom_Resp_Field), 11) .
"', 543 '". save_text(HCU_array_key_value(
'respdob', $Custom_Resp_Field), 10) .
"', '". save_text(HCU_array_key_value(
'respmember', $Custom_Resp_Field), 15) .
"', 544 '". save_text(HCU_array_key_value(
'respphone', $Custom_Resp_Field), 10) .
"', '" . save_text($JSON_FormFields) .
"')";
549 if ($resp_rs = db_query($sql, $dbh)) {
556 $submit_note =
"<br/><br/><span class='submit-note'>WARNING: Usage of the browser's back button may result in additional applications being submitted.</span>";
557 if (isset($_POST[
'btnFormPost']) && $_POST[
'btnFormPost'] ==
'Submit') {
563 list($app_submitted, $app_desc) = (SubmitApplication($HB_ENV, $response_id, $JSON_FormFields, HCU_array_key_value(
"respmember", $Custom_Resp_Field)));
565 if ($app_submitted) {
569 $app_desc =
"Your application was sent to the credit union and returned with the following message:<br>$app_desc{$submit_note}";
576 WHERE role = 'onldepnotify' AND cu = '$DMSAPP_CURRENTCUCODE' ";
577 $not_rs = db_query($sql, $dbh);
578 list($adm_email) = db_fetch_array($not_rs,0);
579 $adm_email = trim(preg_replace(
"/ +$/",
"",$adm_email));
581 db_free_result($not_rs);
584 $notifyName = trim($Custom_Resp_Field[
'respfname']) .
" " . trim($Custom_Resp_Field[
'resplname']);
585 $notifyMbr = (trim($Custom_Resp_Field[
'respmember']) ==
'' ?
'' :
"\nMember Number: {$Custom_Resp_Field['respmember']}");
587 if ($adm_email !=
"") {
589 if (array_key_exists(
'resploandesc', $Custom_Resp_Field)) {
590 $loanDescTitle =
" (" . trim($Custom_Resp_Field[
'resploandesc']) .
")";
594 $ATTN =
"Online Loan Application{$loanDescTitle} from {$notifyName}";
595 $mail_message =
"\t$Cu ONLINE LOAN APPLICATION\n\nA new online loan application was submitted to your home banking.\nLogin to admin to view.\n\nPrimary Applicant: {$notifyName}\n{$notifyMbr}\n";
599 $notify->mailto=$adm_email;
600 $notify->replyto=
"nobody@homecu.com";
601 $notify->subject=$ATTN;
602 $notify->msgbody = $mail_message;
603 $notify->file = __FILE__;
609 header(
"HTTP/1.1 303 See Other");
610 header(
"Location: {$self}f=portal&msg=" . urlencode($app_desc));
614 $app_desc =
"Your application was sent to the credit union and returned with the following message:<br>$app_desc";
616 $FORM_VALIDATION_ERROR =
"<li>$app_desc</li>";
631 $app_msg =
"Your application was successfully saved. At any time you may finish the application by using the 'Edit' option";
632 header(
"HTTP/1.1 303 See Other");
633 header(
"Location: {$self}f=portal&msg=" . urlencode($app_msg));
638 $FORM_VALIDATION_ERROR =
"An unexpected error occurred while saving your application.";
646 if ($Master_LoanID > 0 && isset($app_row)) {
649 $JSON_FormPopulate = $app_row[
'respapplication'];
650 } elseif (HCU_array_key_exists(
'new', $loadedValues[
'lnappentry'])) {
651 if ($DMSAPP_ONLINE ==
"1" && $DMSAPP_MODE_ARY[
'offline'] && $DMSAPP_FETCHMIR == 1) {
656 $sql =
"SELECT session_account 657 FROM {$DB_TABLE_PREFIX}user 658 WHERE (userlogintype = 'H' OR userlogintype = 'N') 659 AND userid = " . intval($DMSAPP_CURRENTUSERID) .
" ";
660 $user_rs = db_query($sql, $dbh);
661 $user_row = db_fetch_assoc($user_rs, 0);
662 if ($user_row[
'session_account'] !=
'') {
664 $member = $user_row[
'session_account'];
666 $mirResp = GetMemberInfo($HB_ENV, array(
"member" => $member));
668 $coreAutoFillInfo = Array();
669 if ($mirResp[
'code'] ==
'000') {
674 $mirData = $mirResp[
'data'];
676 foreach ($coreAutoFillFormat as $coreKey => $coreAttr) {
678 $coreAutoFillInfo[$coreKey] = HCU_array_key_value($coreAttr[
'mir_key'], $mirData);
689 $defaultItemsFromCore =
true;
705 $PageTagOpen = False;
706 $GroupTagOpen = False;
707 $LineTagOpen = False;
708 $HoldLineOpen = False;
719 $Build_CSS_Menu =
"";
722 $inputLabelBsClass =
" col-md-3 ";
724 $inputFieldBsClass =
" col-md-9 ";
726 $inputBsFullWidth =
" col-xs-12 ";
732 #menu-items .local-menu-error { 735 #menu-items .grouperror .local-menu-error { 738 display:
inline-block;
741 .k-datepicker.k-header .k-picker-wrap {
744 .k-datepicker .k-picker-wrap .k-select .k-icon {
757 print
"<form id='appentry' name='appentry' action='{$self}f=Entry' method='post'> 758 <input type='hidden' name='respid' value='$App_RespID'> 759 <input type='hidden' name='loanid' value='$Master_LoanID'> 760 <input type='hidden' name='cookieval_$random' value='SET'> 762 <div id='appcontent' class='container-fluid'>";
764 $form_build_required_list =
"";
765 $form_build_mandatory_list =
"";
766 $loop_required_list =
"";
767 $AppCertifyStatement =
"";
768 foreach ($App_SchemaDetail as $Detail_key => $Detail_value) {
770 $fieldtype = $Detail_value[
'fieldtype'];
771 $fieldvalue = disp_text($Detail_value[
'fieldvalue']);
773 $fieldattr = HCU_jsondecode($Detail_value[
'fieldattr'],
false,
false);
776 $formfieldname =
"formfield_" . $Detail_key;
778 $formconditionalname =
"";
780 $formfieldrequired = GetClassPropertyVal($fieldattr,
'validation_require') >= 1 ?
"<em class='hcu-required-field'>*</em>" :
"";
781 $formfieldegtext =
"";
782 $formfieldhelpurl =
"";
791 if (GetClassPropertyVal($fieldattr,
'validation_require') == 2) {
793 $loop_required_list =& $form_build_mandatory_list;
796 $loop_required_list =& $form_build_required_list;
812 if (property_exists($fieldattr,
'append_class')) {
814 $field_class .= $fieldattr->append_class;
816 if (property_exists($fieldattr,
'egtext')) {
817 $formfieldegtext = $fieldattr->egtext;
819 if (property_exists($fieldattr,
'helpurl')) {
821 $formfieldhelpurl =
" <a href='" . $fieldattr->helpurl->href .
"' class='' target=_NEW>" . $fieldattr->helpurl->display .
"</a>";
824 if (GetClassPropertyVal($fieldattr,
'submitstatement') == 1) {
825 $AppCertifyStatement = GetClassPropertyVal($fieldattr,
'defaultval');
830 if (GetClassPropertyVal($fieldattr,
'autofillfromcore') !==
false && HCU_array_key_exists(GetClassPropertyVal($fieldattr,
'autofillfromcore') , $coreAutoFillInfo) && $defaultItemsFromCore) {
832 switch (HCU_array_key_value(GetClassPropertyVal($fieldattr,
'autofillfromcore') , $coreAutoFillInfo)) {
835 $phone = preg_replace(
"/[^0-9 ]/",
"", $coreAutoFillInfo[$fieldattr->autofillfromcore]);
837 $coreValue = preg_replace(
"/([0-9]{3})([0-9]{3})([0-9]{4})/",
"$1-$2-$3", $phone);
840 $zip = preg_replace(
"/[^0-9 ]/",
"", $coreAutoFillInfo[$fieldattr->autofillfromcore]);
842 if (strlen($zip) > 5) {
843 $coreValue = preg_replace(
"/([0-9]{5})([0-9]{4})/",
"$1-$2", $zip);
849 $ssn = preg_replace(
"/[^0-9 ]/",
"", $coreAutoFillInfo[$fieldattr->autofillfromcore]);
851 $coreValue = preg_replace(
"/([0-9]{3})([0-9]{2})([0-9]{4})/",
"$1-$2-$3", $ssn);
858 $coreValue = date(
"m/d/Y", strtotime($coreAutoFillInfo[$fieldattr->autofillfromcore]));
861 $coreValue = $coreAutoFillInfo[$fieldattr->autofillfromcore];
866 $valuesItemsFromCore[
'formfield_' . $Detail_key] = $coreValue;
869 $fieldSetReadOnly = (intval(GetClassPropertyVal($fieldattr,
'readonly')) == 1 ?
' readonly ' :
'');
871 switch ($fieldtype) {
877 StartDMSTag ($LAYOUT_PAGE, $PAGE_COUNT, $fieldvalue);
878 print
"<h1 class='page-header'>$fieldvalue</h1>";
884 StartDMSTag($LAYOUT_GROUP, 0,$fieldvalue);
885 print
"<legend>$fieldvalue</legend>";
889 if (GetClassPropertyVal($fieldattr,
'hidden') != 1) {
892 <div
class=
"form-group {$field_class}">
893 <!--<label
class=
"{$inputLabelBsClass} control-label"></label>-->
894 <div
class=
"{$inputBsFullWidth}">
895 <p
class=
"form-control-static">$fieldvalue{$formfieldhelpurl}</p>
903 $yesVal = ($fieldtype ==
"YNR01" ?
"1" :
"Y");
904 $noVal = ($fieldtype ==
"YNR01" ?
"0" :
"N");
906 if (isset($fieldattr->hidden) && $fieldattr->hidden == 1) {
907 print
"<input type='hidden' id='$formfieldname' group='group_{$GROUP_COUNT}' name='$formfieldname' value='" . GetClassPropertyVal($fieldattr,
'defaultval') .
"'>";
911 StartDMSTag($LAYOUT_LINE);
912 if (GetClassPropertyVal($fieldattr,
'validation_require')) {
913 if (GetClassPropertyVal($fieldattr,
'validation_require_conditional') !=
'') {
915 $loop_required_list .=
"if (\$('input:radio[conditional=" . $fieldattr->validation_require_conditional->field .
"]:checked').val()== '" . $fieldattr->validation_require_conditional->value .
"') {\$(\"input[id='{$formfieldname}']\").radioNotChecked('', 'Yes/No reply is required.');}\n";
918 $loop_required_list .=
"$(\"input[id='{$formfieldname}']\").radioNotChecked('', 'Yes/No reply is required.');\n";
922 if (GetClassPropertyVal($fieldattr,
'validation_conditionname') !=
'') {
923 $formconditionalname =
" conditional='{$fieldattr->validation_conditionname}' ";
927 <div
class=
"form-group {$field_class}">
928 <label
for=
'$formfieldname' class=
"{$inputLabelBsClass} control-label $field_class">$fieldvalue $formfieldrequired</label>
929 <div
class=
"{$inputFieldBsClass}">
930 <label
class=
"radio-inline">
931 <input type=
'radio' group=
'group_{$GROUP_COUNT}' id=
'$formfieldname' name=
'$formfieldname' $formconditionalname value=
'$yesVal'/> Yes
933 <label
class=
"radio-inline">
934 <input type=
'radio' id=
'$formfieldname' name=
'$formfieldname' $formconditionalname value=
'$noVal' title=
'$fieldvalue'/> No
936 <span
id=
'error_$formfieldname' class=
''></span>
948 $yesVal = ($fieldtype ==
"YNS01" ?
"1" :
"Y");
949 $noVal = ($fieldtype ==
"YNS01" ?
"0" :
"N");
952 if (GetClassPropertyVal($fieldattr,
'validation_require')) {
953 if (GetClassPropertyVal($fieldattr,
'validation_require_conditional') !=
'') {
955 $loop_required_list .=
"if (\$('input:radio[conditional=" . $fieldattr->validation_require_conditional->field .
"]:checked').val()== '" . $fieldattr->validation_require_conditional->value .
"') {\$('#{$formfieldname}').require();}\n";
957 $loop_required_list .=
"$('#{$formfieldname}').require();\n";
960 if (GetClassPropertyVal($fieldattr,
'validation_conditionname') !=
'') {
961 $formconditionalname =
" conditional='{$fieldattr->validation_conditionname}' ";
964 $setInputMaskEntry .=
"\n" .
'$("#' . $formfieldname .
'").kendoDropDownList();';
966 StartDMSTag($LAYOUT_LINE);
968 <div
class=
"form-group {$field_class}">
969 <label
for=
'$formfieldname' class=
"{$inputLabelBsClass} control-label">$fieldvalue $formfieldrequired</label>
970 <div
class=
"{$inputFieldBsClass}">
971 <select
id=
'$formfieldname' $formconditionalname group=
'group_{$GROUP_COUNT}' name=
'$formfieldname' title=
'$fieldvalue' class=
'input-select-100'>
972 <option value=
''></option>
973 <option value=
'$yesVal'>Yes</option>
974 <option value=
'$noVal'>No</option>
976 <span
id=
'error_$formfieldname' class=
''></span>
991 $printKTextbox =
true;
994 if (isset($fieldattr->hidden) && $fieldattr->hidden == 1) {
995 print
"<input type='hidden' id='$formfieldname' group='group_{$GROUP_COUNT}' name='$formfieldname' value='" . GetClassPropertyVal($fieldattr,
'defaultval') .
"'>";
997 StartDMSTag($LAYOUT_LINE);
998 if (GetClassPropertyVal($fieldattr,
'validation_match')) {
1005 $field_class .=
" " . $fieldattr->validation_match;
1006 if (GetClassPropertyVal($fieldattr,
'validation_match') ===
'date') {
1019 $setInputMaskEntry .=
"\n" .
'$("#' . $formfieldname .
'").kendoDatePicker({format:"MM/dd/yyyy"});';
1020 $setInputMaskEntry .=
"\n" .
'$("#' . $formfieldname .
'").kendoMaskedTextBox({mask: "00/00/0000",promptChar: "_"});';
1021 $fieldattr->maxlength =
'';
1023 } elseif (GetClassPropertyVal($fieldattr,
'validation_match') ===
'phone') {
1024 $setInputMaskEntry .=
"\n" .
'$("#' . $formfieldname .
'").kendoMaskedTextBox({mask:"###-###-####"});';
1025 $fieldattr->maxlength =
'';
1026 $inputType =
"phone";
1027 } elseif (GetClassPropertyVal($fieldattr,
'validation_match') ===
'ssn') {
1028 $setInputMaskEntry .=
"\n" .
'$("#' . $formfieldname .
'").kendoMaskedTextBox({mask:"###-##-####"});';
1029 $fieldattr->maxlength =
'';
1031 } elseif (GetClassPropertyVal($fieldattr,
'validation_match') ===
'usd' || GetClassPropertyVal($fieldattr,
'validation_match') ===
'number') {
1032 $printKTextbox =
false;
1034 $inputType =
"number";
1035 if (GetClassPropertyVal($fieldattr,
'validation_match') ===
'usd') {
1039 $widgetConfigOptions =
'';
1042 if (GetClassPropertyVal($fieldattr,
'validation_require_numeric_range_chk')) {
1043 if (GetClassPropertyVal($fieldattr,
'validation_require_numeric_range_chk') == 1) {
1045 if (GetClassPropertyVal($fieldattr,
'validation_require_numeric_range')) {
1046 if (GetClassPropertyVal($fieldattr->validation_require_numeric_range,
'min')) {
1047 $value = $fieldattr->validation_require_numeric_range->min;
1049 $widgetConfigOptions .=
"min: $value,";
1052 if (GetClassPropertyVal($fieldattr->validation_require_numeric_range,
'max')) {
1053 $value = $fieldattr->validation_require_numeric_range->max;
1055 $widgetConfigOptions .=
"max: $value,";
1062 $setInputMaskEntry .=
"\n" .
'$("#' . $formfieldname .
'").kendoNumericTextBox({format:"' . $inputFmt .
'",spinners: false, ' . $widgetConfigOptions .
'});';
1067 if (GetClassPropertyVal($fieldattr,
'validation_require')) {
1068 if (GetClassPropertyVal($fieldattr,
'validation_require_conditional') !=
'') {
1070 $loop_required_list .=
"if (\$('input:radio[conditional=" . GetClassPropertyVal($fieldattr->validation_require_conditional,
'field') .
"]:checked').val()== '" . GetClassPropertyVal($fieldattr->validation_require_conditional,
'value') .
"') {\$('#{$formfieldname}').require();}\n";
1073 $loop_required_list .=
"$('#{$formfieldname}').require();\n";
1076 $localDefVal = GetClassPropertyVal($fieldattr,
'defaultval');
1078 $printMaxLength = GetClassPropertyVal($fieldattr,
'maxlength');
1079 $printEgText =($formfieldegtext !=
'' ? $formfieldegtext :
'');
1081 $kTextboxOut = ($printKTextbox ?
"k-textbox" :
"");
1082 print <<< APP_GENERAL
1083 <div
class=
"form-group {$field_class}">
1084 <label
class=
'{$inputLabelBsClass} control-label' for=
'$formfieldname'>$fieldvalue $formfieldrequired</label>
1085 <div
class=
"{$inputFieldBsClass}">
1086 <input type=
'{$inputType}' id=
'$formfieldname' group=
'group_{$GROUP_COUNT}' name=
'$formfieldname' class=
'$kTextboxOut hcu-all-100 $field_class' value=
'{$localDefVal}' 1087 maxlength=
'{$printMaxLength}' $fieldSetReadOnly title=
'$fieldvalue' data-toggle=
'tooltip' data-placement=
'right' placeholder=
'$printEgText' novalidate>
1089 <span
id=
'error_$formfieldname' class=
''></span>
1097 $localDefVal = GetClassPropertyVal($fieldattr,
'defaultval');
1098 if (isset($fieldattr->hidden) && $fieldattr->hidden == 1) {
1100 print
"<input type='hidden' id='$formfieldname' group='group_{$GROUP_COUNT}' name='$formfieldname' value='{$fieldattr->defaultval}'>";
1102 StartDMSTag($LAYOUT_LINE);
1104 if (GetClassPropertyVal($fieldattr,
'validation_require')) {
1105 if (GetClassPropertyVal($fieldattr,
'validation_require_conditional') !=
'') {
1108 $loop_required_list .=
"if (\$('input:radio[conditional=" . $fieldattr->validation_require_conditional->field .
"]:checked').val()== '" . $fieldattr->validation_require_conditional->value .
"') {\$('#{$formfieldname}').checkboxChecked('', 'Confirm $formfieldname');}\n";
1110 $loop_required_list .=
"$('#{$formfieldname}').checkboxChecked('', 'Confirm $formfieldname');\n";
1115 <div
class=
"form-group {$field_class}">
1116 <label
for=
'$formfieldname' class=
"{$inputLabelBsClass} control-label $field_class">$fieldvalue $formfieldrequired</label>
1117 <div
class=
"{$inputFieldBsClass}">
1118 <label
class=
"checkbox-inline">
1119 <input type=
'checkbox' id=
'$formfieldname' group=
'group_{$GROUP_COUNT}' name=
'$formfieldname' class=
'$field_class' value=
'{$localDefVal}' title=
'$fieldvalue' />
1121 <label
class=
"checkbox-inline">
1124 <span
id=
'error_$formfieldname' class=
''></span>
1134 StartDMSTag($LAYOUT_LINE);
1135 if (GetClassPropertyVal($fieldattr,
'validation_require')) {
1136 if (GetClassPropertyVal($fieldattr,
'validation_require_conditional') !=
'') {
1138 $loop_required_list .=
"if (\$('input:radio[conditional=" . GetClassPropertyVal($fieldattr->validation_require_conditional,
'field') .
"]:checked').val()== '" . GetClassPropertyVal($fieldattr->validation_require_conditional,
'field') .
"') {\$('#{$formfieldname}').require();}\n";
1140 $loop_required_list .=
"$('#{$formfieldname}').require();\n";
1143 if (GetClassPropertyVal($fieldattr,
'validation_conditionname') !=
'') {
1144 $formconditionalname =
" conditional='" . GetClassPropertyVal($fieldattr,
'validation_conditionname') .
"' ";
1148 print <<< PRINT_SCRIPT
1149 <div
class=
"form-group {$field_class}">
1150 <label
for=
'$formfieldname' class=
"{$inputLabelBsClass} control-label $field_class">$fieldvalue $formfieldrequired</label>
1151 <div
class=
"{$inputFieldBsClass}">
1153 print Display_AnswerList($fieldattr->fieldansid, $formfieldname,
"S", $fieldvalue,
'', (isset($fieldattr->defaultval) ? $fieldattr->defaultval :
''), $formconditionalname, $field_class);
1154 print <<< PRINT_SCRIPT
1161 $(document).ready(
function() {
1162 $(
"#{$formfieldname}").kendoDropDownList();
1171 StartDMSTag($LAYOUT_LINE);
1172 if (GetClassPropertyVal($fieldattr,
'validation_require')) {
1173 $tFieldLabel = ($fieldvalue !=
'' ? $fieldvalue :
'Answer');
1174 if (GetClassPropertyVal($fieldattr,
'validation_require_conditional') !=
'') {
1177 $loop_required_list .=
"if (\$('input:radio[conditional=" . $fieldattr->validation_require_conditional->field .
"]:checked').val()== '" . $fieldattr->validation_require_conditional->value .
"') {\$(\"input[id='{$formfieldname}']\").radioNotChecked('', '{$tFieldLabel} is required.');}\n";
1179 $loop_required_list .=
"$(\"input[id='{$formfieldname}']\").radioNotChecked('', '{$tFieldLabel} is required.');\n";
1183 if (GetClassPropertyVal($fieldattr,
'validation_conditionname') !=
'') {
1184 $formconditionalname =
" conditional='{$fieldattr->validation_conditionname}' ";
1186 $radioOptions = Display_AnswerList($fieldattr->fieldansid, $formfieldname,
"R", $fieldvalue,
'',
'', $formconditionalname);
1188 <div
class=
"form-group {$field_class}">
1189 <label
for=
'$formfieldname' class=
"{$inputLabelBsClass} control-label $field_class">$fieldvalue $formfieldrequired</label>
1190 <div
class=
"{$inputFieldBsClass}">
1192 <span
id=
'error_$formfieldname' class=
''></span>
1210 StartDMSTag($LAYOUT_PAGE, -1);
1214 if ($FORM_VALIDATION_ERROR !=
'' && (isset($app_row[
'respsubmiton']) && $app_row[
'respsubmiton'] !=
'')) {
1215 print <<< print_back
1217 <div
class=
"container">
1219 <div
class=
"col-xs-12 col-sm-6 col-md-4">
1220 <input type=
"button" class=
"k-button k-primary hcu-all-100" id=
'linkBack' value=
"Back" onclick=
"window.history.back()"></input>
1229 $link_disclosure =
'';
1230 if (Disclosure_Exists($Master_LoanID, -1)) {
1231 $link_disclosure =
"<li class='list_nostyle'><a target='_NEW' href='{$self_full_url}?f=viewdisclosure&review={$Master_LoanID}'><i class='fa fa-file-text-o'></i> Review Disclosure</a></li><br>";
1233 $AppCertifyStatement = ($AppCertifyStatement !=
'' ?
"<br/>" . $AppCertifyStatement .
"<br/>":
"");
1235 print <<< print_submit
1237 <div
class=
"col-xs-12 col-sm-6 col-md-4">
1238 <button
class=
"k-button hcu-all-100" hrefx=
"#" id=
'btnNavPrev'><i
class=
"fa fa-caret-left fa-2x" aria-hidden=
"true"></i><span
class=
" x-hidden-xs"> <span
id=
'btnSpanPrev'>Previous</span></span></button>
1240 <div
class=
"col-xs-12 col-sm-6 col-md-offset-4 col-md-4 x-col-xs-offset-4 text-right">
1241 <button
class=
"k-button hcu-all-100" hrefx=
"#" id=
'btnNavNext'><span
class=
"x-hidden-xs"><span
id=
'btnSpanNext'>Next</span> </span></span><i
class=
"fa fa-caret-right fa-2x" aria-hidden=
"true"></i></button>
1246 <div
class=
"hidden-xs col-sm-12">
1247 <div
class=
"control-group"><br/><br/></div>
1252 <div
class=
"col-xs-12">
1253 <p
class=
'h4'>Would you like to save
this application and
continue at a later time?</p>
1257 <div
class=
"col-xs-12 col-sm-6 col-md-4">
1258 <input
class=
"k-button hcu-all-100" href=
"#" id=
'linkFormPost' label=
'Save' value=
'Save For Later'></input>
1263 <div
class=
"hidden-xs col-sm-12">
1264 <div
class=
"control-group"><br/><br/></div>
1269 <div
class=
"col-xs-12">
1270 <p
class=
'h4'>Is your application complete and ready to be submitted to the credit
union?</p>
1275 <div
class=
"col-xs-12">
1280 <div
class=
"col-xs-12">
1281 <p
class=
'h4'><span style=
'font-size:0.85em;'>{$AppCertifyStatement}</span></p>
1285 <div
class=
"col-xs-12 col-sm-6 col-md-4">
1286 <input type=
"button" class=
"k-button k-primary hcu-all-100" href=
"#" id=
'linkFormPost' label=
'Submit' value=
"Submit Now"></input>
1293 if ($Build_CSS_Menu !=
'') {
1296 <ul id='list-menu' class='nav root-nav-categories'> 1303 <div
id=
"menu-items" style=
"display:none;">
1304 <?php echo $Build_CSS_Menu; ?>
1308 $(document).ready(
function() {
1310 $(
'#sidebar-nav').append($(
'#menu-items'));
1311 $(
'#menu-items').show();
1319 if ($defaultItemsFromCore && count($valuesItemsFromCore) > 0) {
1320 $JSON_FormPopulate = json_encode($valuesItemsFromCore);
1322 if (isset($JSON_FormPopulate) && $JSON_FormPopulate !=
'' ) {
1324 <script language=
"javascript">
1326 $(
'#appentry').populate($JSON_FormPopulate);
1334 print
"<input type='hidden' id='form_currentpage' name='form_currentpage' value='1'>";
1335 print
"<input type='hidden' id='form_pagecount' name='form_pagecount' value='$PAGE_COUNT'>";
1336 print
"<input type='hidden' id='btnFormPost' name='btnFormPost' value=''>";
1341 <script type=
'text/javascript'>
1343 var pghdr_title =
"";
1345 var lastGroupGo =
"";
1346 var lastSecurePage =
"";
1351 container =
".validity-summary-container",
1355 erroneous =
"validity-erroneous",
1358 errors =
"." + erroneous,
1375 window.onload =
function FormOnLoad() {
1376 var vid_id = $(
"#securepage1");
1377 $(
'div[id^="securepage"]').hide();
1382 $(document).ready(
function() {
1385 getShowWaitFunctions(); ?>
1390 $(
'a[id^="page"]').click(
function(event){
1393 event.preventDefault();
1394 var vid_id = $(
this).attr(
"id").replace(
"page",
"#securepage");
1395 var vid_html = $(
this).attr(
"href").replace(
"#",
"");
1397 var $contentContainer =
null;
1398 if ($(
'#hcu-nav-toggle').css(
'display') !==
'none') {
1399 $contentContainer = $(
'#content-wrapper');
1401 $contentContainer = $(
'#homecu-container');
1404 $(
'div[id^="securepage"]').hide();
1406 $contentContainer.scrollTop(0);
1408 $(
'#form_currentpage').val($(
this).attr(
"id").replace(
"page",
""));
1410 if ($(
'.' + vid_html).length) {
1413 newTop = $(
'.' + vid_html).offset().top;
1418 if (vid_id == lastSecurePage && lastSecurePage !=
'') {
1420 $contentContainer.scrollTop($contentContainer.scrollTop() + newTop);
1423 $contentContainer.scrollTop(newTop);
1429 lastSecurePage = vid_id;
1430 lastGroupGo = vid_html;
1433 $(
'#body-wrapper').removeClass(
'collapse');
1434 $(
'#body-wrapper').removeClass(
'in');
1442 $(
'button[id^=btnNav]').click(
function(event) {
1443 event.preventDefault();
1444 target = $(
this).html();
1446 var new_pg = Number($(
'#form_currentpage').val());
1447 if (this.
id.match(/Next/)) {
1449 new_pg = Number($(
'#form_currentpage').val()) + 1;
1451 }
else if (this.
id.match(/Prev/)) {
1452 new_pg = Number($(
'#form_currentpage').val()) - 1;
1455 if (new_pg != $(
'#form_currentpage').val()) {
1456 $(
'div[id^="securepage"]').hide();
1457 $(
'#securepage' + new_pg).show();
1459 $(
'#form_currentpage').val(new_pg);
1467 $.validity.outputs.custom = {
1472 $(
"." + $.validity.settings.cssClass)
1476 $(errors).removeClass(erroneous);
1479 $(
'li[id ^= "group"]').removeClass(
'grouperror');
1480 $(
'span[id ^= "error_formfield"]').removeClass(
'error');
1481 $(
'span[id ^= "error_formfield"]').hide();
1485 end:
function(results) {
1487 if (!results.valid && $.validity.settings.scrollTo) {
1488 location.hash = $(
"." + $.validity.outputs.custom.cssClass +
":eq(0)").attr(
'for');
1493 if (buffer.length) {
1497 $.homecuValidator.displayMessage(buffer, $.homecuValidator.settings.statusError);
1500 if ($.validity.settings.scrollTo) {
1501 location.hash = $(errors +
":eq(0)").attr(
"id");
1506 raise:
function($obj, msg) {
1509 if ($obj.attr(
'id') !== undefined || $obj.attr(
'name') !== undefined) {
1510 var labelSelector =
"#error_" + getIdentifier($obj);
1513 var re =
new RegExp(
'is required.\$');
1514 if (msg.match(re)) {
1515 field_msg =
"Required";
1519 field_msg =
'<i class="fa fa-exclamation-triangle" aria-hidden="true"></i> ' + field_msg;
1521 if ($(labelSelector).length) {
1524 $(labelSelector).html(field_msg);
1526 $(labelSelector).addClass(
'error');
1527 $(labelSelector).show();
1533 labelSelector =
"." + $.validity.outputs.custom.cssClass +
"[for='" + getIdentifier($obj) +
"']";
1535 .attr(
"for",
"error_" + getIdentifier($obj))
1536 .attr(
"id",
"error_" + getIdentifier($obj))
1537 .addClass($.validity.outputs.custom.cssClass)
1561 if ($obj.attr(
'data-role') ===
'numerictextbox') {
1562 if ($obj.parent().parent(
'.k-numerictextbox').length > 0) {
1563 $obj.parent().parent(
'.k-numerictextbox').addClass(erroneous);
1565 $obj.addClass(erroneous);
1567 }
else if ($obj.attr(
'data-role') ===
'dropdownlist') {
1568 if ($obj.parent(
'.k-dropdown').children(
'.k-dropdown-wrap').length > 0) {
1569 $obj.parent(
'.k-dropdown').children(
'.k-dropdown-wrap').addClass(erroneous);
1571 $obj.addClass(erroneous);
1573 }
else if ($obj.attr(
'data-role') ===
'maskedtextbox') {
1574 if ($obj.parent().parent(
'.k-maskedtextbox').length > 0) {
1575 $obj.parent().parent(
'.k-maskedtextbox').addClass(erroneous);
1577 $obj.addClass(erroneous);
1583 $obj.addClass(erroneous);
1586 var field_attr = $obj.attr(
"group");
1588 $(
'#' + field_attr).addClass(
'grouperror');
1591 raiseAggregate:
function($obj, msg) {
1593 this.
raise($obj, msg);
1595 container:
function() {
1601 $.validity.setup({ outputMode:
'custom' });
1608 $(
"#appentry").validity(
function() {
1610 <?php echo $setExtraValidityCmds; ?>
1612 $(
'input.date').match(
'date',
'#{field} is not a valid date ##/##/####.');
1613 $(
'input.ssn').match(/^\d{3}-\d{2}-\d{4}$/,
"#{field} needs to be in the format of ###-##-####.");
1614 $(
'input.phone').match(
'phone',
'#{field} must be formatted as ###-###-####.');
1615 $(
'input.email').match(
'email',
'#{field} must be formatted as an email.');
1616 $(
'input.integer').match(
'integer',
"#{field} must be a positive, whole number.");
1617 $(
'input.usd').match(
'usd',
"#{field} must be formatted as a US Dollar amount.");
1618 $(
'input.url').match(
'url',
"#{field} must be formatted as a URL.");
1619 $(
'input.number').match(
'number',
"#{field} must be formatted as a number.");
1620 $(
'input.zip').match(
'zip',
"#{field} must be formatted as a zipcode ##### or #####-####.");
1623 if (target ==
'Submit') {
1624 <?php echo $form_build_required_list; ?>
1627 <?php echo $form_build_mandatory_list; ?>
1635 <?php echo $setInputMaskEntry; ?>
1639 $(
"input[type='text'],input[type='phone'],input[type='ssn'],input[type='date']").change(
function() {
1642 var erroneous =
"validity-erroneous",
1643 errors =
"." + erroneous;
1645 var cur_elem_name = $(
this).attr(
'name');
1646 if (cur_elem_name !=
'') {
1649 $(
'#error_' + cur_elem_name).removeClass(
'error');
1650 $(
'#error_' + cur_elem_name).hide();
1659 if ($(
this).attr(
'data-role') ===
'numerictextbox') {
1660 if ($(
this).parent().parent(
'.k-numerictextbox').length > 0) {
1661 $(
this).parent().parent(
'.k-numerictextbox').removeClass(erroneous);
1665 $(
this).removeClass(erroneous);
1677 $(
'input.date').match(
'date',
'Invalid Format');
1678 $(
'input.ssn').match(/^\d{3}-\d{2}-\d{4}\$/,
"Invalid Format");
1679 $(
'input.phone').match(
'phone',
'Invalid Format');
1680 $(
'input.email').match(
'email',
'Invalid Format');
1681 $(
'input.integer').match(
'integer',
"Number Expected");
1682 $(
'input.usd').match(
'usd',
"Dollar Amount Expected");
1683 $(
'input.url').match(
'url',
"Invalid Format");
1684 $(
'input.number').match(
'number',
"Invalid Format");
1685 $(
'input.zip').match(
'zip',
"Invalid Format");
1690 $(
'a[id^=btnNav]').click(
function() {
1694 $(
'input[id^=linkFormPost]').click(
function() {
1699 $(
this).attr(
"disabled",
"disabled");
1702 target = $(
this).attr(
"label");
1704 $(
'#btnFormPost').val(target);
1706 $(
"#appentry").submit();
1708 $(
this).removeAttr(
"disabled");
1715 <?php
if ($FORM_VALIDATION_ERROR !=
'') { ?>
1716 $.homecuValidator.displayMessage(
'<?php echo addslashes($FORM_VALIDATION_ERROR); ?>', $.homecuValidator.settings.statusError);
1726 function AssignNavButton() {
1727 var cur_pg = $(
'#form_currentpage').val();
1728 var pg_cnt = $(
'#form_pagecount').val()
1732 $(
'#btnNavPrev').hide();
1733 $(
'#btnNavNext').show();
1735 pghdr_title =
"pghdr_" + Number(Number(cur_pg) + 1);
1737 $(
'#btnSpanNext').html(
'' + $(
'div[id^=' + pghdr_title +
']').attr(
"title"));
1738 }
else if (cur_pg < pg_cnt) {
1740 $(
'#btnNavPrev').show();
1741 pghdr_title =
"pghdr_" + Number(Number(cur_pg) - 1);
1742 $(
'#btnSpanPrev').html(
'' + $(
'div[id^=' + pghdr_title +
']').attr(
"title"));
1744 $(
'#btnNavNext').show();
1745 pghdr_title =
"pghdr_" + Number(Number(cur_pg) + 1);
1747 $(
'#btnSpanNext').html(
'' + $(
'div[id^=' + pghdr_title +
']').attr(
"title"));
1748 }
else if (cur_pg == pg_cnt) {
1749 $(
'#btnNavPrev').show();
1750 pghdr_title =
"pghdr_" + Number(Number(cur_pg) - 1);
1751 $(
'#btnSpanPrev').html(
'' + $(
'div[id^=' + pghdr_title +
']').attr(
"title"));
1753 $(
'#btnNavNext').hide();
1755 $(
'#btnNavPrev').show();
1756 $(
'#btnNavNext').show();
1757 pghdr_title =
"pghdr_" + Number(Number(cur_pg) - 1);
1758 $(
'#btnSpanPrev').html(
'' + $(
'div[id^=' + pghdr_title +
']').attr(
"title"));
1760 pghdr_title =
"pghdr_" + Number(Number(cur_pg) + 1);
1761 $(
'#btnSpanNext').html(
'' + $(
'div[id^=' + pghdr_title +
']').attr(
"title"));
1766 function getIdentifier($obj) {
1767 return $obj.attr(
'id') !== undefined && $obj.attr(
'id').length ? $obj.attr(
'id') : $obj.attr(
'name');
1770 function RefreshCookie() {
1771 var refresh_url =
"{$self_full_url}?f=refresh";
1774 xmlhttp =
new XMLHttpRequest();
1775 xmlhttp.onreadystatechange=
function() {
1776 if (xmlhttp.readyState==4 && xmlhttp.status==200) {
1781 xmlhttp.open(
"GET",refresh_url,
true);
1789 }
catch (Exception $ex) {
1790 print <<< formException
1791 <div
class=
"col-lg-6">
1792 <div
class=
"alert alert-danger " role=
"alert">
1803 function BuildSerialObject($pApp_Response_json) {
1804 global $App_SchemaDetail, $DB_TABLE_PREFIX, $DMSAPP_LOANDATAONLY;
1807 $core_values_array = Array();
1810 $local_values_array = Array();
1812 $combine_values_array = Array();
1814 $attr_values_array = Array();
1816 $core_values_serial =
"";
1818 $pApp_Response_Array = json_decode($pApp_Response_json);
1819 $localFieldsRegex =
'/([\w]+)+/';
1823 foreach ($App_SchemaDetail as $schema_detailid => $schema_detailvalue) {
1825 $fieldattr = json_decode($App_SchemaDetail[$schema_detailid][
'fieldattr'],
true);
1826 $fieldkey =
"formfield_" . $schema_detailid;
1828 $localMatches = Array();
1831 if (HCU_array_key_value(
'fieldcorename', $fieldattr) !=
'' && HCU_array_key_value(
'localfieldonly', $fieldattr) !=
'1') {
1832 $attr_values_array[$fieldattr[
'fieldcorename']] = $fieldattr;
1840 if (trim($pApp_Response_Array->$fieldkey) !=
'' || ($DMSAPP_LOANDATAONLY != 1) || (intval(HCU_array_key_value(
'fieldcorealwayssend', $fieldattr)) == 1)) {
1842 $pApp_Response_Array->$fieldkey = FormatDateForSubmit($pApp_Response_Array->$fieldkey, HCU_array_key_value(
'validation_match', $fieldattr));
1844 if (strpos($fieldattr[
'fieldcorename'],
",") === FALSE) {
1845 if (isset($fieldattr[
'fieldcorearrayindex'])) {
1846 $core_values_array[$fieldattr[
'fieldcorearrayindex']][$fieldattr[
'fieldcorename']] = $pApp_Response_Array->$fieldkey;
1848 $core_values_array[$fieldattr[
'fieldcorename']] = $pApp_Response_Array->$fieldkey;
1852 $pieces = explode(
",", $fieldattr[
'fieldcorename']);
1853 foreach ($pieces as $fieldcorename_piece) {
1854 $fieldcorename_piece = trim($fieldcorename_piece);
1855 if (isset($fieldattr[
'fieldcorearrayindex'])) {
1856 $core_values_array[$fieldattr[
'fieldcorearrayindex']][$fieldcorename_piece] = $pApp_Response_Array->$fieldkey;
1858 $core_values_array[$fieldcorename_piece] = $pApp_Response_Array->$fieldkey;
1863 if (!empty($fieldattr[
'fieldcombinelocal']) ) {
1865 preg_match_all($localFieldsRegex, $fieldattr[
'fieldcombinelocal'], $localMatches);
1866 if (count($localMatches) > 0) {
1868 $delim = (!empty($fieldattr[
'fieldcombinelocaldelim']) ? $fieldattr[
'fieldcombinelocaldelim'] :
' ');
1869 $skipifblank = (isset($fieldattr[
'fieldcombineskipblankfield']) ? (intval($fieldattr[
'fieldcombineskipblankfield']) == 1 ? 1 : 0) : 0);
1871 $combine_values_array[$fieldattr[
'fieldcorename']][
'fields2combine'] = $localMatches[0];
1872 $combine_values_array[$fieldattr[
'fieldcorename']][
'fieldsdelim'] = $delim;
1873 $combine_values_array[$fieldattr[
'fieldcorename']][
'fieldsskipifblank'] = $skipifblank;
1874 if (!empty($fieldattr[
'maxlength'])) {
1875 $combine_values_array[$fieldattr[
'fieldcorename']][
'maxlength'] = $fieldattr[
'maxlength'];
1877 if (!empty($fieldattr[
'fieldcorearrayindex'])) {
1878 $combine_values_array[$fieldattr[
'fieldcorename']][
'fieldcorearrayindex'] = $fieldattr[
'fieldcorearrayindex'];
1882 } elseif (HCU_array_key_value(
'localfieldonly', $fieldattr) ==
'1' &&
1883 HCU_array_key_value(
'fieldcorename', $fieldattr) !=
'') {
1884 $attr_values_array[$fieldattr[
'fieldcorename']] = $fieldattr;
1886 $local_values_array[$fieldattr[
'fieldcorename']] = $pApp_Response_Array->$fieldkey;
1892 if (HCU_array_key_value(
"dmsapp_coapp_status", $local_values_array) ==
"N") {
1894 unset($core_values_array[
'C']);
1898 if (is_array($combine_values_array)) {
1899 foreach ($combine_values_array as $coreFieldName => $localFieldsAry) {
1906 if (is_array($localFieldsAry[
'fields2combine'])) {
1907 $allFieldsEmpty =
true;
1909 for ($localIdx = 0; $localIdx < count($localFieldsAry[
'fields2combine']); $localIdx++) {
1910 $allFieldsEmpty = (trim($local_values_array[$localFieldsAry[
'fields2combine'][$localIdx]]) !=
'' ? false : $allFieldsEmpty);
1912 $skipfieldifblank = (isset($attr_values_array[$localFieldsAry[
'fields2combine'][$localIdx]][
'fieldcombineskipblankfield']) ? (intval($attr_values_array[$localFieldsAry[
'fields2combine'][$localIdx]][
'fieldcombineskipblankfield']) == 1 ? 1 : 0) : 0);
1914 if ($skipfieldifblank == 0 || (trim($local_values_array[$localFieldsAry[
'fields2combine'][$localIdx]]) !=
'')) {
1916 $comboValue .= ($localIdx > 0 ? $localFieldsAry[
'fieldsdelim'] :
'');
1918 $comboValue .= $local_values_array[$localFieldsAry[
'fields2combine'][$localIdx]];
1922 if ($comboValue !=
'') {
1924 if (!empty($localFieldsAry[
'maxlength'])) {
1925 $comboValue = substr($comboValue, 0, $localFieldsAry[
'maxlength']);
1927 if ((trim($comboValue) !=
'' && !$allFieldsEmpty) || ($DMSAPP_LOANDATAONLY != 1) || isset($attr_values_array[$coreFieldName][
'fieldcorealwayssend']) && (intval($attr_values_array[$coreFieldName][
'fieldcorealwayssend']) == 1)) {
1929 if (!empty($localFieldsAry[
'fieldcorearrayindex'])) {
1931 $core_values_array[$localFieldsAry[
'fieldcorearrayindex']][$coreFieldName] = $comboValue;
1933 $core_values_array[$coreFieldName] = $comboValue;
1941 if (isset($GLOBALS[
'DMSAPP_LOANFORMAT'])) {
1942 $loanformat = $GLOBALS[
'DMSAPP_LOANFORMAT'];
1945 switch ($loanformat) {
1947 $core_values_serial = json_encode($core_values_array);
1950 $core_values_serial = generate_valid_xml_from_array($core_values_array,
"NewLoanApplication");
1953 $core_values_serial = serialize($core_values_array);
1955 return $core_values_serial;
1968 function SubmitApplication($pHbEnv, $pApp_RespID, $pApp_Response, $pApp_RespMbr) {
1969 global $DB_TABLE_PREFIX, $DMSAPP_SUBMITMBR;
1973 if ($GLOBALS[
'DMSAPP_ONLINE']) {
1975 if ($GLOBALS[
'DMSAPP_MODE_ARY'][
'offline']) {
1976 $CoreSerialValue = BuildSerialObject($pApp_Response);
1987 $txnValues = array(
"member" => ($DMSAPP_SUBMITMBR == 1 ? $pApp_RespMbr :
'NULL'),
1988 "type" => PACKET_REQUEST_NEWAPP,
1989 "pkt-type" => PACKET_REQUEST_NEWAPP,
1990 "tran_code" =>
'NULL',
1991 "ref1" => $CoreSerialValue,
2003 $reqResult = PostTransactionRequest($pHbEnv, $txnValues,
true);
2006 if (HCU_array_key_exists(
'code', $reqResult[
'data'])) {
2007 $ret_status = $reqResult[
'data'][
'code'];
2008 $ret_statusdesc = $reqResult[
'data'][
'desc'];
2009 $ret_apploanid = $reqResult[
'data'][
'seg1'];
2011 $ret_status =
'999';
2012 $ret_statusdesc =
'Unknown status';
2013 $ret_apploanid = -1;
2017 switch (trim($ret_status)) {
2024 $ret_statdesc =
"Loan was successfully submitted.";
2025 $sql_set =
"respcoreloanappid = " . intval($ret_apploanid) .
", 2026 respsubmiton = now(), 2028 resplastinquire = now(), 2029 respstatusdesc = '" . prep_save ($ret_statdesc) .
"' ";
2042 $sql_set =
"respstatus = '$ret_status', 2043 respstatusdesc = '" . prep_save($ret_statusdesc) .
"' ";
2060 $sql_set =
"respcoreloanappid = " . intval($ret_apploanid) .
", 2061 respstatus = '$ret_status', 2062 respsubmiton = now(), 2063 resplastinquire = now(), 2064 respstatusdesc = '" . prep_save($ret_statusdesc) .
"' ";
2068 $ret_status =
"999";
2069 $ret_statdesc =
"We are currently having problems communicating with the credit union. Please save your application and try to submit again later. <br>$ret_statusdesc";
2072 if ($sql_set !=
'') {
2074 $sql =
"UPDATE {$DB_TABLE_PREFIX}userresponse 2076 WHERE respid = " . intval($pApp_RespID);
2077 if (!$resp_rs = db_query($sql, $dbh)) {
2078 $ret_status =
"999";
2079 $ret_statdesc =
"An unknown error occurred. Please try again.";
2086 switch($ret_status) {
2095 return array(
true, $ret_statusdesc);
2099 return array(
false, $ret_statusdesc.
"<br/>Your application has been saved. You may return later and submit your application.");
2103 return array(
false, $GLOBALS[
'DMSAPP_MODE_ARY'][
'offlineDesc'] .
"<br/>Your application has been saved. You may return later when the system is online and submit your application.");
2107 $ret_status =
"029";
2108 $ret_statusdesc =
"The loan was submitted for Credit Union review.";
2109 $sql =
"UPDATE {$DB_TABLE_PREFIX}userresponse 2111 respsubmiton = now(), 2113 resplastinquire = now(), 2114 respstatusdesc = '" . prep_save ($ret_statusdesc) .
"' 2115 WHERE respid = " . intval($pApp_RespID);
2116 if ($upd_rs = db_query($sql, $dbh)) {
2117 return array(
true, $ret_statusdesc);
2119 return array(
false,
"Unexpected error submitting application.");
2124 function generate_xml_from_array($array, $node_name) {
2127 if (is_array($array) || is_object($array)) {
2128 foreach ($array as $key=>$value) {
2129 if (is_numeric($key)) {
2133 $xml .=
'<' . $key .
'>' . generate_xml_from_array($value, $node_name) .
'</' . $key .
'>';
2136 $xml = htmlspecialchars($array, ENT_QUOTES);
2142 function generate_valid_xml_from_array($array, $node_block=
'nodes', $node_name=
'node') {
2151 $xml =
'<?xml version="1.0" encoding="UTF-8" ?>';
2154 $xml .=
'<' . $node_block .
'>';
2155 $xml .= generate_xml_from_array($array, $node_name);
2156 $xml .=
'</' . $node_block .
'>';
2171 function FormatDateForSubmit ($p_value, $p_value_type) {
2174 switch ($p_value_type) {
2177 $p_value = str_replace(
",",
"", $p_value);
2178 $retVal = number_format(floatval($p_value), 2,
".",
"");
2184 $retVal = str_replace(
",",
"", $p_value);
2206 function ValidateRange($pFieldLabel, $pFieldAttr, $pFieldVal) {
2212 if (array_key_exists(
"validation_require_numeric_range_chk", $pFieldAttr)) {
2213 $verifyRange = ($pFieldAttr[
'validation_require_numeric_range_chk'] == 1 ? 1 : 0);
2220 if (array_key_exists(
"validation_require_numeric_range", $pFieldAttr)) {
2222 if (array_key_exists(
"min", $pFieldAttr[
"validation_require_numeric_range"])) {
2223 $rangeMinVal = $pFieldAttr[
"validation_require_numeric_range"][
"min"];
2226 if (array_key_exists(
"max", $pFieldAttr[
"validation_require_numeric_range"])) {
2227 $rangeMaxVal = $pFieldAttr[
"validation_require_numeric_range"][
"max"];
2235 if ($rangeMinVal !=
'' && ($pFieldVal < $rangeMinVal)) {
2236 $retErrors .=
"<li>$pFieldLabel is less than the minimum allowed ($rangeMinVal).</li>";
2239 if ($rangeMaxVal !=
'' && ($pFieldVal > $rangeMaxVal)) {
2240 $retErrors .=
"<li>$pFieldLabel is greater than the maximum allowed ($rangeMaxVal).</li>";