I have a block on a page that has a narrative of information that was entered into the database.
block1267 image
In the upper right corner of the block, I have the Edit link, which opens the form in the same block (link code: <a class="top_members_menu" onclick="return !loadDynamicBlock(1267, this.href);" href="https://caredesign.net/m/clients/AddInitialContact?client=c6yz3YiX"></a>).
block1267 form image
With dolphin Forms submission and checking, after clicking the submit button, the form would normally run through the checker functions and check that, but to do so, it submits to itself. So, how do I code the action line so that it reloads the page, with the proper content in block 1267 instead of the default content?
This is the code for the function that displays the form:
function actionAddInitialContact ()
{
$client = $_GET['client'];
// Demographics Section
$aForm = array(
'form_attrs' => array(
'name' => 'form_search_books',
'action' => BX_DOL_URL_ROOT . 'm/clients/AddIc?client=' . $client,
'method' => 'post',
),
'params' => array (
'db' => array(
'submit_name' => 'submit_form',
),
'csrf' => array(
'disable' => true,
),
),
'inputs' => array(
'client_id' => array(
'type' => 'text',
'name' => 'client_id',
'caption' => _t("_client_id"),
'value' => $client,
'db' => array (
'pass' => 'Xss',
),
),
'AloneOrNot' => array(
'type' => 'radio_set',
'name' => 'AloneOrNot',
'caption' => _t("_AloneOrNot"),
'required' => true,
'values' => array(
'Yes' => 'Yes',
'No' => 'No',
),
'db' => array (
'pass' => 'Xss',
),
),
'WhoIsHelping' => array(
'type' => 'text',
'name' => 'WhoIsHelping',
'caption' => _t("_WhoIsHelping"),
'db' => array (
'pass' => 'Xss',
),
),
'Location' => array(
'type' => 'text',
'name' => 'Location',
'caption' => _t("_Location"),
'db' => array (
'pass' => 'Xss',
),
),
'SIComments' => array(
'type' => 'text',
'name' => 'SIComments',
'caption' => _t("_SIComments"),
'db' => array (
'pass' => 'Xss',
),
),
'HIComments' => array(
'type' => 'text',
'name' => 'HIComments',
'caption' => _t("_HIComments"),
'db' => array (
'pass' => 'Xss',
),
),
'DangerComments' => array(
'type' => 'text',
'name' => 'DangerComments',
'caption' => _t("_DangerComments"),
'db' => array (
'pass' => 'Xss',
),
),
'Psychosis' => array(
'type' => 'text',
'name' => 'Psychosis',
'caption' => _t("_Psychosis"),
'db' => array (
'pass' => 'Xss',
),
),
'CapacityYN' => array(
'type' => 'text',
'name' => 'CapacityYN',
'caption' => _t("_CapacityYN"),
'db' => array (
'pass' => 'Xss',
),
),
'CapacityComment' => array(
'type' => 'text',
'name' => 'CapacityComment',
'caption' => _t("_CapacityComment"),
'db' => array (
'pass' => 'Xss',
),
),
'ContractForSafety' => array(
'type' => 'text',
'name' => 'ContractForSafety',
'caption' => _t("_ContractForSafety"),
'db' => array (
'pass' => 'Xss',
),
),
'SafetyPlanComments' => array(
'type' => 'text',
'name' => 'SafetyPlanComments',
'caption' => _t("_SafetyPlanComments"),
'db' => array (
'pass' => 'Xss',
),
),
'InsuranceIssues' => array(
'type' => 'text',
'name' => 'InsuranceIssues',
'caption' => _t("_InsuranceIssues"),
'db' => array (
'pass' => 'Xss',
),
),
'Stressors' => array(
'type' => 'text',
'name' => 'Stressors',
'caption' => _t("_Stressors"),
'db' => array (
'pass' => 'Xss',
),
),
'InitialContactInstructions' => array(
'type' => 'text',
'name' => 'InitialContactInstructions',
'caption' => _t("_InitialContactInstructions"),
),
'KnownMed' => array(
'type' => 'text',
'name' => 'KnownMed',
'caption' => _t("_KnownMed"),
'db' => array (
'pass' => 'Xss',
),
),
'GeneralHealth' => array(
'type' => 'text',
'name' => 'GeneralHealth',
'caption' => _t("_GeneralHealth"),
'db' => array (
'pass' => 'Xss',
),
),
'PresentingProblem' => array(
'type' => 'text',
'name' => 'PresentingProblem',
'caption' => _t("_PresentingProblem"),
'db' => array (
'pass' => 'Xss',
),
),
'NextAppDate' => array(
'type' => 'date',
'name' => 'NextAppDate',
'caption' => _t("_NextAppDate"),
'db' => array (
'pass' => 'Xss',
),
),
'NextAppHour' => array(
'type' => 'text',
'name' => 'NextAppHour',
'caption' => _t("_NextAppHour"),
'db' => array (
'pass' => 'Xss',
),
),
'addictions' => array(
'type' => 'text',
'name' => 'addictions',
'caption' => _t("_addictions"),
'db' => array (
'pass' => 'Xss',
),
),
'treatment_comments' => array(
'type' => 'text',
'name' => 'treatment_comments',
'caption' => _t("_treatment_comments"),
'db' => array (
'pass' => 'Xss',
),
),
'med_note' => array(
'type' => 'text',
'name' => 'med_note',
'caption' => _t("_med_note"),
'db' => array (
'pass' => 'Xss',
),
),
'Submit' => array (
'type' => 'submit',
'name' => 'submit_form',
'value' => _t('_Submit'),
'colspan' => true,
),
),
);
$oForm = new BxTemplFormView ($aForm);
$oForm->initChecker();
if ($oForm->isSubmittedAndValid ()) {
// add additional vars to database, in this case creation date field is added
$aValsAdd = array (
);
echo 'insert last id: ' . $oForm->insert ($aValsAdd); // insert validated data to database
}
echo DesignBoxContent(_t('_initial_contact_form'), $oForm->getCode (), 1);
}
Any assistance would be greatly appreciated. Thanks in advance.