CodeIgniter Forums
Form helper - novalidate - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Form helper - novalidate (/showthread.php?tid=71011)



Form helper - novalidate - Nome - 06-26-2018

Maybe I'm wrong but using the form helper it's impossible to specify single attributes. Today I wanted to use "novalidate" so far I have not figured out how to fix it.


RE: Form helper - novalidate - php_rocs - 06-26-2018

@Nome,

It is not impossible. What form field type are you trying create with a novalidate attribute?


RE: Form helper - novalidate - Nome - 06-26-2018

(06-26-2018, 12:16 PM)php_rocs Wrote: @Nome,

It is not impossible.  What form field type are you trying create with a novalidate attribute?

Oh sure:


Code:
<form ... novalidate>...</form>

Example:

PHP Code:
<?= form_open_multipart('answer/add', array('class' => 'needs-validation''but no validate ?'));?>



RE: Form helper - novalidate - yehanny - 01-04-2021

Hi, to do that you can pass your attributes to the form as an array like this:


PHP Code:
<?php $attributes = array('name' => 'answer_add''autocomplete' => 'off''class' => 'needs-validation''novalidate' => 'novalidate'); ?>
<?php $hidden 
= array('_user' => $session['user_id']); ?>
<?php 
echo form_open_multipart('answer/add'$attributes$hidden); ?>


The result should be something like this:

Code:
<form action="http://your-url/index.php/answer_add" name="answer_add" autocomplete="off" class="needs-validation" novalidate="novalidate" enctype="multipart/form-data" method="post" accept-charset="utf-8">