⚠ 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

Events in the fields.



Luan
  • profile picture
  • Member

Posted 25 March 2012 - 03:08 AM

Hello there!

I've just started using this library, tryed to use the datatables sometime ago, found the design awesome. This mix is really very very good. Congratulations.

My question is: I want to use some .js events in the fields, Form Masks to be more exactly. In my previous crud i was doing this:

<?php $data_nasc1 = array(
'name' => 'data_nasc',
'id' => 'data_nasc',
'onKeyPress' => 'Data(event, this)',
'value' => set_value('data_nasc'),
'maxlength' => '8',
'class' => 'data',); echo form_input($data_nasc1);?>


How can i do this whit grocerycrud? >>> 'onKeyPress' => 'Data(event, this)' .

Its some variable using change_field_type?

KaBaDaBrA
  • profile picture
  • Member

Posted 25 March 2012 - 17:11 PM

Think you'll have to use some jQuery in the view...basic onkeypress example:


$(document).ready(function() {
$("#target").keypress(function() {
alert("Handler for .keypress() called.");
});
});

Luan
  • profile picture
  • Member

Posted 25 March 2012 - 23:05 PM

[quote name='KaBaDaBrA' timestamp='1332695460' post='922']
Think you'll have to use some jQuery in the view...basic onkeypress example:
[/quote]

Just got home and saw this. Sometimes the aswer is in the first page. I was digging too much haha.

Callbacks are almost everywhere
Everything is automated but you are free to change almost everything. You can customize columns, fields and all the operations with a quick callback. There are examples to understand how callbacks work


[color=#b1b100]return[/color] [color=#ff0000]'+30 <input type="text" maxlength="50" value="'[/color].[color=#0000ff]$value[/color].[color=#ff0000]'" name="phone" style="width:462px">'[/color];

The solution was a simple Callback. Guess im just new to the thing hehe. Thanks anyway.

KaBaDaBrA
  • profile picture
  • Member

Posted 26 March 2012 - 05:56 AM

Awesome glad you got it working :) the callbacks do work great!!!