Welcome Guest, Not a member yet? Register   Sign In
Form helper - novalidate
#1

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.
Reply
#2

@Nome,

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

(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 ?'));?>
Reply
#4

(This post was last modified: 01-04-2021, 08:42 PM by yehanny.)

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">
Reply




Theme © iAndrew 2016 - Forum software by © MyBB