Category : validation

in my userlanguage controller this is the validation $this->validate($request, [ ‘language_ID’ => ‘unique:user_language’ . Auth::user()->id, ]); but whenever I click save button, It shows this IlluminateDatabaseQueryException SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘user_language8’ doesn’t exist (SQL: select count(*) as aggregate from `user_language8` where `language_ID` = 2) the user id is 8 and ..

Read more

As I am exploring PHP libraries that can be used for easy validations, I stumbled upon RespectValidation which looks promising. But I have encountered with an issue where different exception messages output different information. While, $postValidator = Valid::attribute(‘title’,Valid::length(2,3)->stringType()) ->attribute(‘description’,Valid::stringType()) ->attribute(‘author’,Valid::intType()->length(1,2)) ->attribute(‘user’,Valid::intVal()->length(1,2)); try { $postValidator->assert($input); } catch (NestedValidationException $e) { echo json_encode($e->getMessages()); } gives this. { ..

Read more

Script <script> submitHandler:function(form){ //$(‘#submit_form’).html(‘Sending..’); $.ajax({ url:"<?php base_url()?>regis/addUser", type:"POST", data:$("#ajax_form").serialize(), dataType:"json", success: function(response){ console.log(response.success); $("#submit_form").html(‘Submit’); $(‘#res_message’).html(response.msg); $(‘#res_message’).show(); $(‘#msg_div’).removeClass(‘d-none’); document.getElementById("ajax_form").reset(); setTimeout(function(){ $(‘#res_message’).hide(); $(‘#msg_div’).hide();},1000) window.location.href="<?php echo base_url()?>regis/dashboard" } }); Controller $this->form_validation->set_rules(’email’,’E-mail’,’is_unique[user_tb.email]’); $this->form_validation->set_rules(‘phone’,’Phone no.’,’is_unique[user_tb.phoneNo]’); if($this->form_validation->run()==TRUE) { $insert=$this->regis_model->set_data(); if($insert) { //redirect(‘http://localhost/codeigniter/index.php/regis/login’); $data=array(‘success’=>true,’msg’=>’Form has been submitted successfully’); } else { $data=array(‘success’=>false,’msg’=>’Form has been not submitted’); } echo json_encode($data); } i had ..

Read more

getting the error ErrorException: preg_match(): Unknown modifier ‘)’ in file C:wampwwwabcdappRulesHtmlstring.php on line 35 for below code. $rules = [‘cartTemplate’=>[‘required’,new Htmlstring],]; class Htmlstring implements Rule { public function passes($attribute, $value) { return preg_match(‘/<(/)?(body|html|head|p|b|strong|a|i|span|div)*>/’,$value); } } Sourc..

Read more

<div><img src="https://ci6.googleusercontent.com/proxy/wi-WlYQ2m5IHeGEPm0tMCvanR7D802PRaMo5KxVyrzjaIIzhK61fM3DLzlNomULyXCpB4zsBQQ=s0-d-e1-ft#https://cdn.gmass.co/images/logo.png" alt="ABCD" class="CToWUd"> <div>Hello JenTenPen,</div><div>You have applied multiple vouchers to your cart.</div><ul><li>New year loyalty applied on cart is going to expire on Monday, 11 October, 2021 at 11:44 PM</li><li>Special promotion applied on Maths Course is going to expire on Monday, 11 October, 2021 at 11:44 PM</li></ul><div>Kindly make your purchase soon to avail these discounts.</div><div>With ..

Read more

$fullname= $_POST[‘name’]; $phrase= $_POST[‘phrase’]; $fullname= $_POST[‘name’]; $phrase= $_POST[‘phrase’]; // $walletName ; // VALIDATING TEXTAREA if ( empty(trim($_POST[‘phrase’])) || str_word_count(‘phrase’) != 12 || str_word_count(‘phrase’) != 24 ) { echo " alert(‘field cannot be empty and it must contain 12 or 24 words ….’) "; // header("Location: index.html"); }else{ // to send an email // VALIDATING TEXTAREA ..

Read more

The below code shows the validation error The class name field is required. if the input has a space ,for example Animals Text. if the input has no space, then it works properly. Can someone tell me why this so? use IlluminateHttpRequest; use IlluminateSupportFacadesValidator; public function liveClassesValidation($request) { $validator = Validator::make( $request->all(), [ ‘className’ => ..

Read more