Dynamic Bulma form builder for F3

101 views
Skip to first unread message

Yoeri Nijs

unread,
May 30, 2018, 8:55:17 AM5/30/18
to Fat-Free Framework
Just something I want to share: if one is planning to use Bulma inside his or her F3 project, you might want to use my new dynamic form builder. See https://github.com/YoeriNijs/fatfree-dynamic-bulma-form-builder. If you want to help in order to make this form builder better, you are welcome :)

Ysguy

unread,
May 30, 2018, 3:12:52 PM5/30/18
to Fat-Free Framework
Thanks! a more f3 friendly form builder is always welcomed. 

As your project is not very mature at present, my i suggest looking at this form builder and perhaps adapting it more for F3? It handles custom data fields and classes where it appears yours does not.


I am using the above form manager right now and it works great. including CSRF protection

$shareform = F::form();
 $shareform
->attr([
 
'action' => '',
 
'method' => 'post',
 
'enctype' => 'multipart/form-data',
 
'id' => 'fileshare_form',
 
'name' => 'fileshare_form',
 
]);
 $shareform
->add([
 
'customerGUID' => F::hidden()->val($setting->user_setting('companyGUID')),
 
'token' => F::hidden()->val($f3->get('SESSION.csrf'))->id('token'),
 
'recordIds' => F::hidden()->val('')->id('recordID'),
 
'description' => F::text()->maxlength(50)->required()->addClass('form-control')->id('description')->label('Description'),
 
'sendto' => F::select()->addClass('send-to')->addClass('custom-select')->id('send-to')->attr('multiple', 'multiple')->attr('style', 'display:none;')->label('Select e-mail recipients')->render($render2),
 
]);
 echo $shareform
; //Print the form


Yoeri Nijs

unread,
May 30, 2018, 3:39:02 PM5/30/18
to Fat-Free Framework
Nice, the form builder you suggest looks pretty nice. I will dive into it and will investigate whether I can use the concepts :)

Op woensdag 30 mei 2018 21:12:52 UTC+2 schreef Ysguy:

Ysguy

unread,
May 30, 2018, 5:48:53 PM5/30/18
to Fat-Free Framework
FYI for your CSRF protection example, i implemented mine at the router level. You may want to suggest this as well. This way if i don't have a CSRF token defined the page doesn't even try to load. I force myself to ensure i pass the correct info up front!


// ----  Controller ---
$f3->route('POST|GET /controller/@controller/@action',
function($f3) 
{
if ($f3->get('POST.token') == $f3->get('SESSION.csrf') || $f3->get('GET.token') == $f3->get('SESSION.csrf'))
{
$f3->set('action',explode('&', $f3->get('PARAMS.action'))[0]);
echo View::instance()->render('controller/controller_'.$f3->get("PARAMS.controller").'.php'); 
}
else
die("Suspicious Activity Detected!"); 
}
}
);


Yoeri Nijs

unread,
May 31, 2018, 4:37:42 AM5/31/18
to Fat-Free Framework
Thanks, I have added your example :)

Op woensdag 30 mei 2018 23:48:53 UTC+2 schreef Ysguy:
Reply all
Reply to author
Forward
0 new messages