Jump to content

Custom form and input


Go to solution Solved by bfarber,

Recommended Posts

I'm new to this community And I'm developing an app.
I have a few questions :
1. Can I use my own custom form inputs or I have to use the default helpers?
2. Can I use other editors such as Summernote or Quill instead of the default editor?
3- Can I use custom style in forms and tables, etc. with custom icons and colors?
4- And instead of using the Upload helper, can I use an input file tag and handle the upload myself, or must I use the default helper(Upload)?

Of course I know that all of the above is possible (I've done for test).But I want to know if I have permission to do this or I must use the defined helpers (upload, editor, stack, etc.)?

Link to comment
Share on other sites

  • Solution
20 hours ago, ReyDev said:

1. Can I use my own custom form inputs or I have to use the default helpers?

You could either (1) create new form helper classes to facilitate custom inputs (we do this in Pages), or (2) use a custom form template to output the end result HTML however you want. There is also a Custom helper which lets you completely define the HTML and validation.

$form->add( new \IPS\Helpers\Form\Custom( 'comments_meta_color', 'none', FALSE, array( 'getHtml' => function( $element )
{
	return \IPS\Theme::i()->getTemplate( 'forms', 'core', 'front' )->colorSelection( $element->name, $element->value );
} ), NULL, NULL, NULL, 'comments_meta_color' ) );

//

\IPS\Output::i()->output = $form->customTemplate( array( \IPS\Theme::i()->getTemplate( 'forms', 'core' ), 'popupTemplate' ) );
20 hours ago, ReyDev said:

2. Can I use other editors such as Summernote or Quill instead of the default editor?

Not out of the box, but again if you create your own form helper classes you could.

20 hours ago, ReyDev said:

3- Can I use custom style in forms and tables, etc. with custom icons and colors?

As per the first question, you can use custom form templates to completely adjust the form HTML. We do this when generating a topic (although we still use the regular form helper row HTML).

20 hours ago, ReyDev said:

4- And instead of using the Upload helper, can I use an input file tag and handle the upload myself, or must I use the default helper(Upload)?

I would strongly recommend to use the Upload helper, but it's not a requirement if you have a compelling reason not to. Note that the Upload helper does a ton of stuff to facilitate uploads including chunking the uploads if they're too big, performing security checks on the uploaded files, storing files in the appropriate area (S3, database, filesystem, etc.). You'd have to keep those things in mind if you don't use the helper but still want to distribute your work.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...