Results 1 to 8 of 8

Thread: get form before action save

  1. #1
    Join Date
    Jun 2009
    Posts
    13

    Default get form before action save

    Hi All
    I have a trouble problem about GET FORM before insert data into Database. I did not see method $_REQUEST (or $_POST) to get value from FORM .
    Everybody may explain to me. I had tried for a long time but not success.
    Thanks & Best Regard

  2. #2
    eescribano's Avatar
    eescribano is offline Senior Member
    Join Date
    Mar 2009
    Location
    Netherlands
    Posts
    85

    Default Re: get form before action save

    You can access to the form data using $_REQUEST. Where you were trying to access to the data?
    If you want to do something with the data, after or before saving, for example. You have to use a logic_hook.

    Information about logic_hooks:
    http://www.sugarcrm.com/wiki/index.p...le=Logic_Hooks
    Elisabeth Escribano
    Webdeveloper

    MADCAP verademing in ict

    e.escribano@madcap.nl

    Schapedrift 89
    3371 JJ Hardinxveld-Giessendam
    Netherlands
    Tel 088 99 088 99
    Fax 088 99 088 98

    www.madcap.nl

  3. #3
    Join Date
    Jun 2009
    Posts
    13

    Default Re: get form before action save

    Hi you,
    CRM get data from vardefs file, but i did not see method $_REQUEST ( $_POST) that get value from "FORM", then it can insert data into database.
    As function save in SugarBean file , i see :
    foreach($this->field_defs as $field=>$value)
    {
    $this->field_defs : to be got from vardefs file, but i action "var_dump($this->$field);" then i see it show data which i had inputed before. I did not understand "why it get value from "FROM". It must have function that get ($_REQUEST) data after "submit" .
    You can explain about it .
    Thanks & Best Regard .

  4. #4
    eescribano's Avatar
    eescribano is offline Senior Member
    Join Date
    Mar 2009
    Location
    Netherlands
    Posts
    85

    Default Re: get form before action save

    Can you explain what do you want to achieve, and what are you doing to make it possible?

    If you want to change a value from the edit form before it is save or something like that... or if you want to check the values you are sending in the form... I just don't understand what do you want to know.

    Can you explain it better?
    Elisabeth Escribano
    Webdeveloper

    MADCAP verademing in ict

    e.escribano@madcap.nl

    Schapedrift 89
    3371 JJ Hardinxveld-Giessendam
    Netherlands
    Tel 088 99 088 99
    Fax 088 99 088 98

    www.madcap.nl

  5. #5
    Join Date
    Jun 2009
    Posts
    13

    Default Re: get form before action save

    Hi You
    As Example "Module Account" , At EditView page , When click on save button that insert data into database. I did not understand how crm get value from '<FORM>' in order to insert ? (Meaning using $_POST or $_REQUEST).
    You can explain about it.
    Thanks & Best Regard.

  6. #6
    eescribano's Avatar
    eescribano is offline Senior Member
    Join Date
    Mar 2009
    Location
    Netherlands
    Posts
    85

    Default Re: get form before action save

    It uses the $_REQUEST one.
    Elisabeth Escribano
    Webdeveloper

    MADCAP verademing in ict

    e.escribano@madcap.nl

    Schapedrift 89
    3371 JJ Hardinxveld-Giessendam
    Netherlands
    Tel 088 99 088 99
    Fax 088 99 088 98

    www.madcap.nl

  7. #7
    Join Date
    Jun 2009
    Posts
    13

    Default Re: get form before action save

    Hi,
    I have just understand about it.
    It have 2 case:
    Case 1: Save.php -> it called populateFromPost (include/formbase.php)
    Case 2: not Save.php file, it used to function pre_save() (SugarController)
    Purpose i research about it, i want fix error when user using Tool to HACKING FORM. And data of our will be insert not true.

    We can discuss about CRM, it so much wonderful and exciting. Everybody can contact via my YAHOO account: thanhtai862020@yahoo.com, in order to chat or send mail.

    Thanks

  8. #8
    joydeepsingh83 is offline Junior Member
    Join Date
    Dec 2010
    Posts
    2

    Default Re: get form before action save

    Hello All,

    I would like some help from your side. We have created a module called as quotes for a client in sugarcrm.

    We are trying to get the values saved to a text file on aclick event of the button.

    we are using the following code
    <?php
    require_once('include/MVC/View/SugarView.php');
    require_once('include/SugarFields/Fields/Base/SugarFieldBase.php');

    class OM_QuotationController extends SugarController
    {

    function action_SaveFile()
    {
    $this->action_save();
    // write the php code here
    $fname = $this->module;
    $fp = fopen("c:/myfile.txt","w") or exit("unable to open the file");
    //require_once('include/SugarFields/MVC/Controller/SugarController.php');
    require_once('include/SugarFields/SugarFieldHandler.php');
    $sfh = new SugarFieldHandler();
    if($fp != null)
    {
    foreach($this->bean->field_defs as $field => $properties)
    {
    $type = !empty($properties['custom_type']) ? $properties['custom_type'] : $properties['type'];
    $sf = $sfh->getSugarField(ucfirst($type), true);
    if($sf != null)
    $sf->save($this->bean, $_POST, $field, $properties);

    {
    fwrite($fp,$field);
    fwrite($fp,"\t");
    fwrite($fp,$this->bean->id);
    fwrite($fp,"\t");
    fwrite($fp,$this->bean->$field = $_POST[$field]);
    //fwrite($fp,"\t");
    //fwrite($fp,$_POST['assigned_user_id']);
    fwrite($fp,"\n");

    }
    }

    }
    fclose($fp);
    }

    } // end class
    ?>


    But after using this code we are able to generate only the field names and corresponding bean id's
    but no values are being generated.

    we need to get the values generated in the text file also.
    any help in this regard will be greatly appreciated.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. change save button event action
    By sujitkirve in forum Developer Help
    Replies: 5
    Last Post: 2009-10-22, 12:15 PM
  2. $bean->save() action for a Project Task
    By twguk1516 in forum Developer Help
    Replies: 12
    Last Post: 2008-07-16, 05:13 PM
  3. Replies: 4
    Last Post: 2008-04-10, 09:11 PM
  4. customaking save action
    By arffup in forum Developer Help
    Replies: 0
    Last Post: 2008-04-04, 10:19 PM
  5. Web to Lead Form Save
    By whipsaw in forum Installation and Upgrade Help
    Replies: 1
    Last Post: 2007-04-02, 06:38 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •