The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dynamic Form Generation
#1
Could anyone tell me a little bit about this Dynamic Form Generation feature?
  Reply
#2
Its gone over here:
https://userspice.com/documentation-functions/

I've never really used it - other than just using it to look at the function.

@Mudmin might be able to explain it better
  Reply
#3
Yeah. There are a few auto generation features. The best ones are the ones that are designed to update the database (deal with $_POST), unless you want to have all fields be text. I'm probably not explaining that very well.

So let's say you have a table called "assets" with 20 columns in it. You would do something like this...

To EDIT a particular row of the assets table...
Code:
$t = 'assets';
Code:
$skip = ['id'];
Code:
generateForm($t,$id,$skip);
Then to process the form
Code:
$id = Input::get('id');
//make sure you are passing the id in the form itself
//do any checks you want to do here
Code:
$skipFields = ['create_type'];
Code:
$updateFields = updateFields2($_POST, $skipFields);
Code:
$db->insert('assets',$updateFields);
Code:
$db->update('assets',$id,$updateFields);

to ADD a row to that table...
Code:
$t = 'assets';
Code:
$skip = ['id'];
Code:
generateAddForm($t,$skip);

Then to process the form
//do any checks you want to do here
Code:
$skipFields = ['create_type'];
Code:
$updateFields = updateFields2($_POST, $skipFields);
Code:
$db->insert('assets',$updateFields);
  Reply
#4
I acknowledge that this is very much to my knowledge almost nil. This function is not for me, @Mudmin, @Brandin thank you guys.
  Reply
#5
We're happy to help if you give a little more info for what you're trying to do.
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)