Results 1 to 4 of 4

Thread: onsubmit_callback help

  1. #1
    User
    Join Date
    04-10-11.
    Posts
    162

    Default onsubmit_callback help

    Hi, i'm trying to use an onsubmit_callback with my data container.

    The problem i'm having is actually using the field values in my method:

    Code:
    public function setPeriod(DataContainer $dc)
    	{
    		if ($dc->type == 'Period')
    		{// run code }
    It is supposed to check if the 'type' field in my dca that has just been submitted has a value of 'Period' before running some code.

    How can i use the values of the submitted fields? I can retrieve an id using $dc->id, so I assumed to get the value of a field name you used $dc->field_name but this doesn't seem to be working.

    Thanks

  2. #2
    User
    Join Date
    04-10-11.
    Posts
    162

    Default Re: onsubmit_callback help

    I got this figured out now, but it has lead to another problem

    Is there any way to stop contao from adding the data to the database after the onsubmit_callback has been run?

  3. #3
    Experienced user
    Join Date
    01-12-10.
    Posts
    814

    Default Re: onsubmit_callback help

    What is the answer to your original question?

  4. #4
    User
    Join Date
    04-10-11.
    Posts
    162

    Default Re: onsubmit_callback help

    To get the values you use:

    Code:
    $field_value = $dc->activeRecord->field_name;

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
  •