Uncaught TypeError : object is not a function error come when i try to document.index.submit(); - form-submit

<form role="form" class="register-form cf-style-1" name="index" action="#" method="post">
<div class="field-row">
<label>First Name: *</label>
<input type="text" name="firstName" class="le-input">
<label>Last Name: *</label>
<input type="text" name="lastName" class="le-input">
<label>Email: *</label>
<input type="text" name="email" class="le-input">
<input type="hidden" name="dbAction">
<label>Mobile Number: *</label>
<input type="text" name="mobileNumber" class="le-input">
<label>Create Password: *</label>
<input type="password" name="createPassword" class="le-input">
<label>Confirm Password: *</label>
<input type="password" name="confirmPassword" class="le-input">
</div><!-- /.field-row -->
<div class="buttons-holder">
<button type="button" name="submit" onclick="validatePageData();" class="le-button huge">Sign Up</button>
</div><!-- /.buttons-holder -->
</form>
<script>
function validatePageData() {document.index.submit();
}`

document.forms[name ="index"].submit() should work.

Related

PHP Laravel Post action

I have a form page for users informations update but my post function isn't working.I have defined a post method in the blade page and I show the page as a formaction post.This is my code;
#extends('layouts.admin-master')
#section('content')
<form action="post">
<div class="form-row">
<div class="form-group">
<label for="inputAddress2">Ad Soyad</label>
<input type="text" class="form-control" id="inputAddress2" name="name" value="{{ Auth::user()->name }}">
</div>
<br><br>
<div class="form-group">
<label for="inputAddress2">Şirket</label>
<input type="text" class="form-control" id="inputAddress2" name="company">
</div>
</div>
<div class="form-group">
<label for="inputAddress">Email</label>
<input type="text" class="form-control" id="inputAddress" name="email" value="{{ Auth::user()->email }}">
</div>
<div class="form-group">
<label for="inputAddress2">Telefon</label>
<input type="text" class="form-control" id="inputAddress2" name="phone">
</div>
<div class="form-row">
<div class="form-group col-md-4">
<label for="inputState">Üyelik Tipi</label>
<select id="inputState" class="form-control">
<option selected>Seçenekler</option>
<option>Bronz Üyelik</option>
<option>Silver Üyelik</option>
<option>Gold Üyelik</option>
</select>
</div>
<div class="form-group col-md-2">
<label class="radio-container m-r-55">Tedarikçi
<input type="radio" checked="checked" name="secim" value="tedarikci">
<span class="checkmark"></span>
</label>
`enter code here` <label class="radio-container">Alıcı
<input type="radio" name="secim" value="alici">
<span class="checkmark"></span>
</label>
</div>
</div>
<form action="{{route('form.add')}}" method="post" enctype="multipart/form-data">
<button type="submit" class="btn btn-primary">Kaydet</button>
</form>
</form>
#endsection
try this:
#extends('layouts.admin-master')
#section('content')
<form action="{{route('form.add')}}" method="post" enctype="multipart/form-data">
<div class="form-row">
<div class="form-group">
<label for="inputAddress2">Ad Soyad</label>
<input type="text" class="form-control" id="inputAddress2" name="name" value="{{ Auth::user()->name }}">
</div>
<br><br>
<div class="form-group">
<label for="inputAddress2">Şirket</label>
<input type="text" class="form-control" id="inputAddress2" name="company">
</div>
</div>
<div class="form-group">
<label for="inputAddress">Email</label>
<input type="text" class="form-control" id="inputAddress" name="email" value="{{ Auth::user()->email }}">
</div>
<div class="form-group">
<label for="inputAddress2">Telefon</label>
<input type="text" class="form-control" id="inputAddress2" name="phone">
</div>
<div class="form-row">
<div class="form-group col-md-4">
<label for="inputState">Üyelik Tipi</label>
<select id="inputState" class="form-control">
<option selected>Seçenekler</option>
<option>Bronz Üyelik</option>
<option>Silver Üyelik</option>
<option>Gold Üyelik</option>
</select>
</div>
<div class="form-group col-md-2">
<label class="radio-container m-r-55">Tedarikçi
<input type="radio" checked="checked" name="secim" value="tedarikci">
<span class="checkmark"></span>
</label>
`enter code here` <label class="radio-container">Alıcı
<input type="radio" name="secim" value="alici">
<span class="checkmark"></span>
</label>
</div>
</div>
<button type="submit" class="btn btn-primary">Kaydet</button>
</form>
put this line in your form and it should work :
{{csrf_field()}}
and make sure that your route address is correct too
u can add #csrf above the button

why auth its not working in my validation and its showing anything wrong

im just new in laravel and i dont know whats wrong with my code its not redirecting
public function login(Request $request){
$this->validate($request, [
'email'=> 'required|max:32',
'password'=> 'required|confirmed|max:32|min:8',
]);
if (Auth::attempt(['email'=>$request->email,'password'=>$request->password])) {
return redirect('/welcome');
}
return "Oooops something wrong happen";
}
this my login form
<form action="login" method="post">
<input type="hidden" name="_token" value="{{csrf_token()}}">
<div class="form-group">
<input type="email" name="" value="" class="form-control" placeholder="Enter Your Email">
</div>
<div class="form-group">
<input type="password" name="" value="" class="form-control" placeholder="Enter Your password">
</div>
<div class="form-group">
<input type="submit" name="" value="login" class="btn btn-success btn-lg btn-block">
</div>
and my route
Route::post('/login', 'UserController#login');
Your form is wrong, your name values are empty, and you're missing the confirmation password field
<form action="login" method="post">
{{ csrf_field() }}
<div class="form-group">
<input type="email" name="email" class="form-control" placeholder="Enter Your Email">
</div>
<div class="form-group">
<input type="password" name="passowrd" class="form-control" placeholder="Enter Your password">
</div> <div class="form-group">
<input type="password" name="passowrd_confirmation" class="form-control" placeholder="Enter Your password">
</div>
<div class="form-group">
<input type="submit" value="login" class="btn btn-success btn-lg btn-block">
</div>
</form>

Create a table together with nested objects (columns)

In my Spring MVC application I am trying to build a complex form, where a table and the tables columns can be created at once.
When I submit my form, the table is created with all attributes, but it has not columns. Whats wrong with the nested objects?
This is my view:
<form id="form2" class="form-horizontal" action="/Weasy/virtualtable/insert" method="post">
<input type="hidden" id="isVirtual" name="isVirtual" value="true"/>
<input type="hidden" id="query" name="query" value="select * from aktie"/>
<input type="hidden" id="schema" name="schema" value="40"/>
<div class="form-group">
<div class="row">
<label class="col-sm-2 control-label" for="name"><i>Column No</i></label>
<label class="col-sm-2 control-label" for="name"><i>Column Name</i></label>
<label class="col-sm-2 control-label" for="name"><i>Database Type</i></label>
</div>
<div class="row">
<label class="col-sm-2 control-label" for="name"><i>0</i></label>
<label class="col-sm-2 control-label" for="name"><i>ID</i></label>
<div class="col-sm-5">
<input type="hidden" class="form-control" name="obj.columns[0].name" value="ID" placeholder="specify name">
<input type="text" class="form-control" name="obj.columns[0].datatype" value="INTEGER , Size: 11" placeholder="specify datatype">
</div>
</div>
<div class="row">
<label class="col-sm-2 control-label" for="name"><i>1</i></label>
<label class="col-sm-2 control-label" for="name"><i>BESCHREIBUNG</i></label>
<div class="col-sm-5">
<input type="hidden" class="form-control" name="obj.columns[1].name" value="BESCHREIBUNG" placeholder="specify name">
<input type="text" class="form-control" name="obj.columns[1].datatype" value="VARCHAR , Size: 255" placeholder="specify datatype">
</div>
</div>
<div class="row">
<label class="col-sm-2 control-label" for="name"><i>2</i></label>
<label class="col-sm-2 control-label" for="name"><i>ISIN</i></label>
<div class="col-sm-5">
<input type="hidden" class="form-control" name="obj.columns[2].name" value="ISIN" placeholder="specify name">
<input type="text" class="form-control" name="obj.columns[2].datatype" value="VARCHAR , Size: 255" placeholder="specify datatype">
</div>
</div>
<div class="row">
<label class="col-sm-2 control-label" for="name"><i>3</i></label>
<label class="col-sm-2 control-label" for="name"><i>WKN</i></label>
<div class="col-sm-5">
<input type="hidden" class="form-control" name="obj.columns[3].name" value="WKN" placeholder="specify name">
<input type="text" class="form-control" name="obj.columns[3].datatype" value="VARCHAR , Size: 255" placeholder="specify datatype">
</div>
</div>
<div class="row">
<label class="col-sm-2 control-label" for="name"><i>4</i></label>
<label class="col-sm-2 control-label" for="name"><i>NAME</i></label>
<div class="col-sm-5">
<input type="hidden" class="form-control" name="obj.columns[4].name" value="NAME" placeholder="specify name">
<input type="text" class="form-control" name="obj.columns[4].datatype" value="VARCHAR , Size: 255" placeholder="specify datatype">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="name"><i>Source Table</i></label>
<div class="col-sm-5">
<input type="text" class="form-control" id="name" name="name"
value="" placeholder="Virtual Table Name" required>
</div>
</div>
<div class="row">
<div class="col-sm-2"></div>
<div class="col-sm-2">
<input id="execQry" class="btn btn-block btn-primary btn-default"
type="submit" value="Save"
>
</div>
</div>
</div>
</form>
And this is the corresponding method of my controller. When I debug it, I see the table, but it has no columns.
#RequestMapping("insert")
public ModelAndView insert(#ModelAttribute SrcTable obj) {
return update(obj);
}
In your HTML you are trying to simulate a table with bootstrap, if you take a look at http://getbootstrap.com/css/#forms in form-horizontal section it can give you a more table-like structure, but in this case i recommend a table structure inside your form.
Example:
<input type="hidden" id="isVirtual" name="isVirtual" value="true"/>
<input type="hidden" id="query" name="query" value="select * from aktie"/>
<input type="hidden" id="schema" name="schema" value="40"/>
<table class="table">
<thead>
<tr>
<th><i>Column No</i></th>
<th><i>Column Name</i></th>
<th><i>Database Type</i></th>
</tr>
</thead>
<tbody>
<tr>
<td><i>0</i></td>
<td><i>ID</i></td>
<td>
<input type="hidden" class="form-control" name="obj.columns[0].name" value="ID" placeholder="specify name">
<input type="text" class="form-control" name="obj.columns[0].datatype" value="INTEGER , Size: 11" placeholder="specify datatype">
</td>
</tr>
<tr>
<td><i>1</i></td>
<td><i>BESCHREIBUNG</i></td>
<td>
<input type="hidden" class="form-control" name="obj.columns[1].name" value="BESCHREIBUNG" placeholder="specify name">
<input type="text" class="form-control" name="obj.columns[1].datatype" value="VARCHAR , Size: 255" placeholder="specify datatype">
</td>
</tr>
<tr>
<td><i>2</i></td>
<td><i>ISIN</i></td>
<td>
<input type="hidden" class="form-control" name="obj.columns[2].name" value="ISIN" placeholder="specify name">
<input type="text" class="form-control" name="obj.columns[2].datatype" value="VARCHAR , Size: 255" placeholder="specify datatype">
</td>
</tr>
<tr>
<td><i>3</i></td>
<td><i>WKN</i></td>
<td>
<input type="hidden" class="form-control" name="obj.columns[3].name" value="WKN" placeholder="specify name">
<input type="text" class="form-control" name="obj.columns[3].datatype" value="VARCHAR , Size: 255" placeholder="specify datatype">
</td>
</tr>
<tr>
<td><i>4</i></td>
<td><i>NAME</i></td>
<td>
<input type="hidden" class="form-control" name="obj.columns[4].name" value="NAME" placeholder="specify name">
<input type="text" class="form-control" name="obj.columns[4].datatype" value="VARCHAR , Size: 255" placeholder="specify datatype">
</td>
</tr>
</tbody>
</table>
<input id="execQry" class="btn btn-block btn-primary btn-default"
type="submit" value="Save"
>
</form>
While looking this over after a day pause, I found my error.
instead of
<input type="hidden" class="form-control" name="obj.columns[4].name" value="NAME" placeholder="specify name">
I had to use
<input type="hidden" class="form-control" name="columns[4].name" value="NAME" placeholder="specify name">

How to validate multiple value (Array of value ) in single Input (form) in codeigniter

this is the html part when i add more email id's only first email is being validated and rest of emails treat as normal even if they are not in proper
<form action="<?php echo base_url()?>index.php/EMail/show_email">
<div class="form-group">
<label for="exampleInputEmail1">To :</label>
<input type="email" name="toa[]" ng-model="to" placeholder="To" class=" tagsinput" value="ss" />
</div>
<div class="form-group">
<label for="exampleInputEmail1">Subject :</label>
<input type="text" class="form-control" ng-model="sub" name="suba" id="exampleInputEmail1" placeholder="Subject">
<div>{{sub}}</div>
</div>
<div class="form-group">
<label for="exampleInputEmail1">CC :</label>
<input type="text" class="form-control" ng-model="to" name="cca" id="exampleInputEmail1" placeholder="CC">
<div>{{to}}</div>
</div>
<div class="form-group">
<label for="exampleInputEmail1">BCC:</label>
<input type="text" class="form-control" name="bcca" id="exampleInputEmail1" placeholder="BCC">
</div>
<div class="form-group ">
<label for="ccomment" class="control-label">Message</label>
<textarea class="form-control " id="ccomment" name="msg" required></textarea>
</div>
<div class="form-group">
<label for="exampleInputFile">File input</label>
<input type="file" id="exampleInputFile">
<p class="help-block">Example block-level help text here.</p>
</div>
<div class="checkbox">
<label>
<input type="checkbox"> Check me out
</label>
</div>
<input type="submit" onclick="mail()" class="btn btn-primary" value="Send"/>
<button type="submit" class="btn btn-Success">Draft</button>
</form>
this is my controller and "toa "is that field which i mentioned in the image
function show_email(){
$this->form_validation->set_rules("toa[]","To","valid_email");
$this->form_validation->set_rules("cca","CC ","valid_email");
$this->form_validation->set_rules("suba","Subject","required");
$this->form_validation->set_rules("bcca","bcc","valid_email");
$this->form_validation->set_rules("msg","Message","required");
if($this->form_validation->run()==FALSE){
$data["title"]="EMail";
$this->load->view('header',$data);
$this->load->view('sidebar');
$this->load->view('Mail/mail');
}else{
//finish
$ccdata=$this->input->post("cca");
$bccdata=$this->input->post("bcca");
$sub=$this->input->post("suba");
$ms=$this->input->post("msg");
$dataa["username"]="MyProject";
$dataa["msg"]=$ms;
$msg=$this->load->view('Email_Temp/mail',$dataa,TRUE);
$todata=explode(",",$data);
print_r($todata[0]);
//$this->SendEmail($todata,$ccdata,$bccdata,$msg,$sub);
}
}
[Image] this is the field (to) that i want to validate

CasperJs, how to fill a form that only have a class, not a name and not an id?

I want to fill this form, but i dont know how to do it since it only have a classname.
All the examples i saw have an id or a name, to fill the form and submit it, please help.
<form class="header_form" method="post" action="">
<div class="lgn-items">
<div class="login_item">
<label>Email</label>
<input type="text" name="email" tabindex="1" class="inputtext" id="email" />
</div>
<div class="login_item" >
<label>Password</label>
<input type="password" name="password" tabindex="2" class="inputtext" id="pass" />
</div>
<div class="lgn-add">
Registration <span>|</span>
Forgot your password ?
<div class="rembo">
<input type="checkbox" name="remember" value="1" /> Remember me
</div>
</div>
</div>
<div class="login_item lgn-btn" >
<input type="submit" name="login_button" value="Login" tabindex="3" class="login" />
</div>
</form>
You can access to your form using any selector. In your case you to it like this.
casper.then(function () {
casper.fill('form.header_form', {
/** Your parameters here **/
}, true);
});

Resources