How to clear form values after submission

Hello everyone,

Can anyone help on this issue? I have created a form and after the contents are stored in db on "On submit", the contents get retained in the form itself I dunno why it happens.

Any solution pls?

Quote · 9 Aug 2013

there are a few different ways to clear the form after submission; one of which is below - you can try googling for an answer as there are several general posts about the exact same thing.

$(document).ready(function(){ $('#myForm').ajaxForm(function(){this.reset(); alert('success');});});
caredesign.net
Quote · 10 Aug 2013

hmmm! can't help much until we see your custom coded php form

so much to do....
Quote · 10 Aug 2013

Originally, this was not an issue for me, but now it is. Although I did searches on the internet for ways to accomplish this, I have been unsuccessful. I am including my block code as well as a screenshot in hopes someone can give me a hand. Thanks in advance.

 

        function getBlockCode_AddClient()
    {
    $userID = mt_rand(123123123, 999999999);
$aForm = array(
            'form_attrs' => array(
                'name'     => 'form_add_client',
                'method'   => 'post',
            ),

            'params' => array (
              
                      'db' => array(
                    'table' => 'Profiles', // table name
                    'key' => 'ID', // key field name
                    'uri' => '', // uri field name
                    'uri_title' => '', // title field to generate uri from
                    'submit_name' => 'submit_add_client_form', // some filed name with non empty value to determine if the for was submitted,
                                                       // in most cases it is submit button name
                ),
                'csrf' => array(
                      'disable' => true, //if it wasn't set or has some other value then CSRF checking is enabled for current form, take a look at sys_security_form_token_enable to disable CSRF checking completely.
                )
              ),
 'inputs' => array (
        'header1' => array(
            'type' => 'block_header',
            'caption' => _t("Basic Info"),
        ),
        'ID' => array(
            'type' => 'hidden',
            'name' => 'ID',
            'value' => $userID,
                      'db' => array (
                        'pass' => 'Xss', 
                    ),
        ),
        'NickName' => array(
            'type' => 'text',
            'name' => 'NickName',
            'value' => $userID,
            'info' => 'This number is given to client as username to log in. The password is Password. Please advise them to change their password at their earliest convenience.',
            'attrs' => array (
            'readonly' => true,
            ),
            'caption' => _t("Client ID"),
                      'db' => array (
                        'pass' => 'Xss', 
                    ),
        ),
        'FirstName' => array(
            'type' => 'text',
            'name' => 'FirstName',
            'caption' => _t("First Name"),
            'checker' => array (
                'func' => 'length',
                'params' => array(1, 35),
                'error' => _t('_sys_adm_form_err_required_field'),
            ),
                      'db' => array (
                        'pass' => 'Xss', 
                    ),
        ),
        'LastName' => array(
            'type' => 'text',
            'name' => 'LastName',
            'caption' => _t("Last Name"),
            'checker' => array (
                'func' => 'length',
                'params' => array(1, 35),
                'error' => _t('_sys_adm_form_err_required_field'),
            ),
                      'db' => array (
                        'pass' => 'Xss', 
                    ),
        ),
        'Sex' => array(
            'type' => 'radio_set',
            'name' => 'Sex',
            'caption' => _t("Gender"),          
            'values' => array (
                'Male' => 'Male',
                'Female' => 'Female',
            ),           
            'checker' => array (
                'func' => 'avail',
                'error' => _t('_sys_adm_form_err_required_field'),
            ),
                      'db' => array (
                        'pass' => 'Xss', 
                    ),
        ),
        'DateOfBirth' => array(
            'type' => 'date',
            'name' => 'DateOfBirth',
            'caption' => _t("Date Of Birth"),
            'checker' => array (
                'func' => 'length',
                'params' => array(1, 12),
                'error' => _t('_sys_adm_form_err_required_field'),
            ),
                      'db' => array (
                        'pass' => 'Xss', 
                    ),
        ),
        'Phone' => array(
            'type' => 'text',
            'name' => 'Phone',
            'caption' => _t("Phone"),
                      'db' => array (
                        'pass' => 'Xss', 
                    ),
        ),
        'Email' => array(
            'type' => 'text',
            'name' => 'Email',
            'caption' => _t("Email"),
                      'db' => array (
                        'pass' => 'Xss', 
                    ),
        ),
        'Comments' => array(
            'type' => 'textarea',
            'name' => 'Comments',
            'caption' => _t("Comments"),
                      'db' => array (
                        'pass' => 'Xss', 
                    ),
        ),
        'Provider' => array(
            'type' => 'select',
            'name' => 'Provider',
            'caption' => _t("Provider"),
                      'values' => array (
                        '1' => 'admin', 
                        '744492318' => 'Reuel Sample',
                    ),
                      'db' => array (
                        'pass' => 'Xss', 
                    ),
        ),
        'Service' => array(
            'type' => 'hidden',
            'name' => 'Service',
            'caption' => _t("Service Type"),
                      'values' => array (
                        'Individual' => 'Individual', 
                        'Couple' => 'Couple',
                        'Group' => 'Group',
                    ),
                      'db' => array (
                        'pass' => 'Xss', 
                    ),
        ),
        'ClientStatus' => array(
            'type' => 'hidden',
            'name' => 'ClientStatus',
            'caption' => _t("Status"),
            'values' => array ( 
                        'Pending Assignment' => 'Pending Assignment', 
                        'Pending Triage Evaluation' => 'Pending Triage Evaluation', 
                        'Pending Nursing Evaluation' => 'Pending Nursing Evaluation',
                        'Inpatient (Active)' => 'Inpatient (Active)',
                        'IOP Patient (Active)' => 'IOP Patient (Active)',  
                        'PHP Patient (Active)' => 'PHP Patient (Active)', 
                        'Awaiting Consult' => 'Awaiting Consult', 
                        'Consult followup' => 'Consult followup', 
                        'Inactive' => 'Inactive', 
                    ),
                      'db' => array (
                        'pass' => 'Xss', 
                    ),
                ),
        'Password' => array(
            'type' => 'hidden',
            'name' => 'Password',
            'caption' => 'Password',
            'value' => '697e48bf9a0ee12ea897142800f2759d46ed0512',
                      'db' => array (
                        'pass' => 'Xss', 
                    ),
        ),
        'Salt' => array(
            'type' => 'hidden',
            'name' => 'Salt',
            'caption' => 'Salt',
            'value' => 'yykEY5Gv',
                      'db' => array (
                        'pass' => 'Xss', 
                    ),
        ),
                'header1_end' => array(
                    'type' => 'block_end'
                ),
        'header2' => array(
            'type' => 'block_header',
            'caption' => _t("Referral Info"),
        ),
        'Referral' => array(
            'type' => 'radio_set',
            'name' => 'Referral',
            'caption' => _t("Referred"),
                      'values' => array (
                        'Yes' => 'Yes', 
                        'No' => 'No',
                    ),
                      'db' => array (
                        'pass' => 'Xss', 
                    ),
        ),
        'ReferralSource' => array(
            'type' => 'text',
            'name' => 'ReferralSource',
            'caption' => _t("Referral Source (Name)"),
                      'db' => array (
                        'pass' => 'Xss', 
                    ),
        ),
        'ReferralReason' => array(
            'type' => 'textarea',
            'name' => 'ReferralReason',
            'caption' => _t("Referral Notes"),                  
                      'db' => array (
                        'pass' => 'Xss', 
                    ),
                ),
        'InsuranceIssues' => array(
            'type' => 'text',
            'name' => 'InsuranceIssues',
            'caption' => _t("Insurance Issues"),
                      'db' => array (
                        'pass' => 'Xss', 
                    ),
                ),
                'header2_end' => array(
                    'type' => 'block_end'
                ),
        'submit_send' => array(
            'type' => 'submit',
            'name' => 'submit_add_client_form',
            'value' => _t("Add client"),
        ),
    )
);

form-after-submission.png · 166.3K · 173 views
caredesign.net
Quote · 5 Sep 2013

Problem solved - added a header redirect back to page instead of the standard success display

caredesign.net
Quote · 6 Sep 2013
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.