Problems, need help? Have a tip or advice? Post it here.
4 posts Page 1 of 1
Good evening!

I have a DBF that is accessible only when a user is logged in (as I am using the Extended Users Module). I wanted to know when a logged in user submits the date through a DBF, which all tables are employed to save the data (passed from the fields) in the database.

I am asking this as I am sending the data from a form in an Mobile Application. I want to collect the data and save it into the Database for the user filling the form.

Also my DBF user the CRUD functionality by implementing the custom routes.

Please advise.

Regards,
GenXCoders (Aashish)
Image
where innovation meets technology
genxcoders wrote: I have a DBF that is accessible only when a user is logged in (as I am using the Extended Users Module). I wanted to know when a logged in user submits the date through a DBF, which all tables are employed to save the data (passed from the fields) in the database.


When the DBF is successfully submitted and saved, Couch passes the values to all relevant tables, where the editable fields are normally stored. Actual table (couch_relations, couch_pages, couch_data_text, couch_data_numerics etc) is chosen after the field's data type.

If some value is successfully saved via DBF, it means that it can be immediately accessed via fetching tags (pages, get_field, etc.) and passed along wherever you desire by any means (curl, ajax). It is comfortable to do so within k_success block of a dbf.

genxcoders wrote: I am asking this as I am sending the data from a form in an Mobile Application. I want to collect the data and save it into the Database for the user filling the form.


Once you have POST'ed the data to a remote page, that remote page (I assume a Couch-managed page) can employ cms:db_persist to store the field's value as usual.

From a coder's point of view it is a straightforward process, really.
When the DBF is successfully submitted and saved, Couch passes the values to all relevant tables, where the editable fields are normally stored. Actual table (couch_relations, couch_pages, couch_data_text, couch_data_numerics etc) is chosen after the field's data type.

If some value is successfully saved via DBF, it means that it can be immediately accessed via fetching tags (pages, get_field, etc.) and passed along wherever you desire by any means (curl, ajax). It is comfortable to do so within k_success block of a dbf.

does it mean that the tables to be employeed are never fixed?
can i see the query? like something return_sql for cms pages?

Once you have POST'ed the data to a remote page, that remote page (I assume a Couch-managed page) can employ cms:db_persist to store the field's value as usual.

i am trying to understand how to post and to what url... should i post to template.php?q=create

so how can the data be collected from app and posted to server, which in turn will make the posted data save in the database? any ideas?
Image
where innovation meets technology
@trendoman
taking your suggestion of using db_persist and reading the forum posts which state db_persist can be used without form, I have made a quick dirty code. The code works to submit the values to the database. I was wanting your feedbacks on the same.

Here is the quick code:
Code: Select all
<?php require_once( '../../couch/cms.php' ); ?>
<cms:template title='Receive FIR'>

</cms:template>
<cms:content_type 'application/json'/>
<cms:set fir_title="<cms:gpc 'fir_title' method='get' />" />
<cms:set train_no="<cms:gpc 'train_no' method='get' />" />
<cms:set loco_no="<cms:gpc 'loco_no' method='get' />" />
<cms:set ohe_mast="<cms:gpc 'ohe_mast' method='get' />" />
<cms:set date_time="<cms:gpc 'date_time' method='get' />" />
<cms:set informer_name="<cms:gpc 'informer_name' method='get' />" />
<cms:set informer_no="<cms:gpc 'informer_no' method='get' />" />
<cms:set disaster_image="<cms:gpc 'disaster_image' method='get' />" />
<cms:set desc="<cms:gpc 'desc' method='get' />" />
<cms:db_persist
    _auto_title          =    '0'
    _invalidate_cache    =    '0'
    _masterpage          =    'generate-fir.php'
    _mode                =    'create'

    k_page_title       =    "<cms:show fir_title />"
    k_page_name         =   "<cms:show k_page_title />"

    ipt_train_no      =   "<cms:show train_no />"
    ipt_loco_no         =   "<cms:show loco_no />"
    ipt_ohe_mast      =   "<cms:show ohe_mast />"
    ipt_date_time      =   "<cms:show date_time />"
    ipt_informer_name   =   "<cms:show informer_name />"
    ipt_informer_no      =   "<cms:show informer_no />"
    ipt_disaster_image   =   "<cms:show disaster_image />"
    ipt_desc         =   "<cms:show desc />"
>
   <cms:if k_error >
        <font color='red'>ERROR:
           <cms:each k_error >
               <cms:show item /><br>
           </cms:each>
        </font>
    <cms:else />
       {
          "success":"1",
          "id":"<cms:show k_last_insert_id />"
       }
    </cms:if>
</cms:db_persist>
<?php COUCH::invoke(); ?>


Regards,
GenXCoders (Aashish)
Image
where innovation meets technology
4 posts Page 1 of 1
cron