⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

How to add second value to the set_rule callback function?



eritovs
  • profile picture
  • Member

Posted 10 June 2012 - 07:48 AM

[color=#282828][font=helvetica, arial, sans-serif]How to feed second value correctly to the set_rule callback function? [/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]What I'm doing wrong? In result d[/font][/color][color=#282828][font=helvetica, arial, sans-serif]ate field $date1 as word of field "periodfrom" not as date value.[/font][/color]


...
$this->grocery_crud->set_rules('periodto','Period to','callback_check_dates["periodfrom"]');
$output = $this->grocery_crud->render();
...
public function check_dates($datet2,$date1)
{
if ($datet2 >= $date1)
{
return TRUE;
}
else
{
$this->form_validation->set_message('check_dates', $datet2.' date 2 is smaller then '.$date1.' date 1.');
return FALSE;
}
}


[font=helvetica, arial, sans-serif][color=#282828]Please advise with some working example.[/color][/font]

fdias
  • profile picture
  • Member

Posted 10 June 2012 - 16:13 PM

I believe right now you would need to use sessions.

Check web-johnny's posts on the subject:

http://www.grocerycr...sions#entry1645

/topic/498-answered-how-can-i-pass-custom-data-to-callback/#entry2033

eritovs
  • profile picture
  • Member

Posted 11 June 2012 - 00:56 AM

Thanks,
I will wait for new feature additional parameters at all the callbacks.

Lucas
  • profile picture
  • Member

Posted 21 June 2012 - 23:10 PM

you can show me how you would do with session variables ?

imag
  • profile picture
  • Member

Posted 02 August 2012 - 09:45 AM

Hi

I had the same or a similar issue, solved it this way:

$publisher_id = $this->input->post('publisher_id');

I'm accessing just the post array. may this helps.

fdias
  • profile picture
  • Member

Posted 13 August 2012 - 17:37 PM

nice example imag!

tofayelahmed
  • profile picture
  • Member

Posted 14 August 2012 - 06:06 AM

Thanx imag,
But i face a problem.
I take a entry date

$entry_date1 = $this->input->post('entry_date');

and then convert $entry_date = date("Y-m-d",strtotime($entry_date1));
but "$entry_date" shows a invalid value. That is , its shows date in "Y-d-m" format.
:o .