I have a credit card form with a btn that pulls the address from the database (Use home address), its working in the sense that it shows up inside of the textfield but when saving the form, this textfield turns up empty in the db. Anyone got any feedback?
<div class="row clearfix">
<div class="col-md-12 column">
<div class="form-group">
<button href="" ng-click="getAddress(user)" value="Show" class="btn btn-general btn-xs">Use Home Address</button>
<input type="text" data-vkeysinput="" class="form-control" value="{{copyAddress}}"/>
</div>
</div>
</div>
$scope.getAddress = function(user) {
$scope.copyAddress= angular.copy(user.user_address.address_1);
};
angular.copy have absolutely nothing to do with a database.
AngularJS can't even talk to a database - you need some kind of backend to support that.
Related
I have two html pages. First one contains a form with a submit button that navigates to the second page.
The second page basically displays the details entered. How can I display the details entered on the previous page without connecting it to a database?
Page 1 HTML:
<main class="form-signin">
<form method="get" action="confirmation.html">
<div class="card">
<h1>Enter details to book your room</h1>
<label for="inputName">Enter your full name</label>
<input type="text" id="inputName" class="form-control" placeholder="Full Name" required autofocus>
<label for="inputEmail">Enter your email address</label>
<input type="email" id="inputEmail" class="form-control" placeholder="Email Id" required>
<button class="btn btn-lg btn-primary" type="submit">Book Now</button>
</div>
</form>
</main>
Page 2 HTML :
<div class="card">
<h1>Your stay has been successfully booked!</h1>
<div class="details">
<h5>Booking Details</h5>
<h3>Name : <span class="name">name</span> </h3>
<h3>Email Address : <span class="email">email</span></h3>
</div>
<button class="btn btn-lg btn-primary" type="submit">Back to home</button>
</div>
I intend to change the span text on Page 2 with details from Page 1 using javascript
You either store what you need to store in localStorage and read them in the second page, or pass the params as pathParams and decode the URL in the second page.
No need to use cookies, since those will be sent with each one of your requests and it will consume bandwidth you can avoid.
Please refer to this answer about local storage:
Storing Objects in HTML5 localStorage
I have form when user can add achievement.
So it looks like:
<form action="{{ action('SettingsController#addAchievementsSettings') }}" method="post" class="form-horizontal">
{{ csrf_field() }}
<div class="form-group">
<label class="col-lg-2 control-label">Date</label>
<div class="col-lg-6">
<input type="date" placeholder=" " id="date-achievement" name="date_achievement" class="form-control">
</div>
</div>
<div class="form-group">
<label class="col-lg-2 control-label">What</label>
<div class="col-lg-6">
<input type="text" placeholder=" " id="what-achievement" name="what_achievement" class="form-control">
</div>
</div>
<div class="form-group">
<label class="col-lg-2 control-label">Description</label>
<div class="col-lg-10">
<textarea rows="10" cols="30" class="form-control" id="description_achievement" name="description_achievement"></textarea>
</div>
</div>
<button type="button" class="btn btn-warning">Add one more...</button>
<button type="submit" class="btn btn-success">Save</button>
I want to generate another form if somebody click Add one more. How can I reach this and how to add everything to database? Sorry guys for not more code but I do not have any idea
from your question it seems a proper video / tutorial would help you more than just the answer.
for generation I personally use laravelcollective/html.
a good site with lots of videos explaining almost everything in regards to laravel and building sites with it I recomment the laracasts site.
to learn how to build and process forms with laravel I suggest Laravel 5.4 from scratch
specifically for working with forms: Form request data and form validation
After creating your form and submitting your form , you have to validate your data then you will call your model to insert your date in database, i suggest you eloquent to handle database request if you are using laravel
I'm creating a new website for my company using mobirise. The mobirise templates come with predesigned email forms that were created using formoid. When a user uses the email form to send an email the information is sent to formoid and then formoid sends the information to me at my email address. All of the coding in the email form is behind the scenes, so I can't actually see what it's doing.
On one of my forms I need to have the page redirect to another page where users will be able to upload a file to my server using another script. I have contacted mobirise to ask them if they could tell me how to redirect after the user clicks the submit button, but they said I had to contact formoid. So far I haven't gotten a response back from formoid so I thought I would try to look for a solution on my own.
I have tried adding javascript code to the coding on the page, but as I said, most of the coding of the form is somewhere behind the scenes and I can't figure out exactly which coding is performing the form's submit action.
What I was hoping for is a suggestion about how I could add some additional JavaScript coding that would watch for the submit button in the form being clicked and then redirect the page. I'm not positive this is even possible, but I figured that if anyone would be helpful it would be the people who post solutions here. I'm rather new to JavaScript, so I'm not sure where to start and I don't want to experiment for hours and hours and get frustrated because nothing is working.
So, if anyone can give me an idea here I would greatly appreciate it. Below is the coding for the form in case it helps:
<div data-form-alert="true">
<div hidden="" data-form-alert-success="true" class="alert alert-form alert-success text-xs-center">Thanks for uploading your audio file!</div>
</div>
<form action="https://mobirise.com/" method="post" data-form-title="FTP Upload">
<input type="hidden" value="NTcF3QgiRzQHgm5xv+UnYlBBGPR27Q6NZwj5EPuecwUNxuL8vndMlaaoM2PpzlkXlNaFBrtr2mU+CfZxfef01mKMpaQkezUMhyWXZgieem0/pt/V/nU0iUetLNqsEpj7" data-form-email="true">
<div class="row row-sm-offset">
<div class="col-xs-12 col-md-4">
<div class="form-group">
<label class="form-control-label" for="form1-3o-name">Name<span class="form-asterisk">*</span></label>
<input type="text" class="form-control" name="name" required="" data-form-field="Name" id="form1-3o-name">
</div>
</div>
<div class="col-xs-12 col-md-4">
<div class="form-group">
<label class="form-control-label" for="form1-3o-email">Email<span class="form-asterisk">*</span></label>
<input type="email" class="form-control" name="email" required="" data-form-field="Email" id="form1-3o-email">
</div>
</div>
<div class="col-xs-12 col-md-4">
<div class="form-group">
<label class="form-control-label" for="form1-3o-phone">Phone</label>
<input type="tel" class="form-control" name="phone" data-form-field="Phone" id="form1-3o-phone">
</div>
</div>
</div>
<div class="form-group">
<label class="form-control-label" for="form1-3o-message">One or more files are being uploaded to the WORDsmart server. </label>
<textarea class="form-control" name="message" rows="7" data-form-field="Message" id="form1-3o-message"></textarea>
</div>
<div><button type="submit" class="btn btn-info">CONTACT US</button></div>
</form>
in this case, I would recommend you to use another form. As far as I know form wouldn't work if you would bring any changes to form of Mobirise. Just use another form creator and implement it manually to Mobirise's project after publication to the local folder (the project of Mobirise).
You can read tutorial about publishing here: https://mobirise.com/help/local-host-369.html
Just change the action field in the first line of the form, to the page were you would like to send the data.
The next hidden input line with the public key may be deleted also.
I have form like below,
<div ng-if="vm.settingsObj.others.name === 'Course Specialization'">
<div class="form-group">
<div class="col-xs-12" ng-repeat="specialization in vm.settingsObj.course_specialization">
<div class="row">
<div class="form-group col-sm-8" >
<input name="course_specialization{{$index}}" class="form-control" placeholder="Course Specialization" ng-model="specialization.value" >
</div>
<div class="form-group col-sm-4">
<button ng-click="vm.removeStatus('course_specialization',$index)" class="btn btn-danger">Remove</button>
</div>
</div>
</div>
</div>
<div class="form-group">
<button class="btn btn-blue" ng-click="vm.addStatus('course_specialization')" >ADD</button>
</div>
</div>
Here i am incrementing the input field when i click on 'Add' button but when i leave input fields as empty and click on save it is getting saved.So what i need is form validation when my field is empty.Can anyone please help me.Thanks.
You have to wrap all inputs in a single form tag so that you can use angular form validation. Angular provides a well set of validations using classes and form controller and you should go for that. For more information you can find a reference from below links:
link one
or for a overview you can follow
link two
I've followed tutorial from this site: http://iliketomatoes.com/implement-passport-js-authentication-with-sails-js-0-10-2/
Signup form works correctly, everything is saved to my database (MongoDB) but when I want to log in, I've got missing credentials error:
{
"message": "Missing credentials",
"user": false
}
This is strange, I've cloned https://github.com/iliketomatoes/passport_with_sails , sails lift it and everything works fine. I've copied all api source files and configuration to my project. Only views are different but I'm sure that I'm using inputs with names: email and password. And still I have this error.
I was using MongoDB as a database, I've switched to local-disk (as in this repo) and still the same problem. I've changed versions of npm modules in package.json file to the one from the repo and still the same error. It is strange.
Also I have to mention that POST request contains email and password fields. I've double checked it.
Someone knows what can cause this problem?
EDIT:
My login.ejs view looks like this:
<div class="row">
<div id="content" class="col-sm-12 full">
<div class="row">
<div class="login-box">
<div class="header">
Login to JSCS Dashboard
</div>
<form class="form-horizontal login" action="/login" method="POST">
<fieldset class="col-sm-12">
<div class="form-group">
<div class="controls row">
<div class="input-group col-sm-12">
<input type="email" class="form-control" name="email" placeholder="E-mail"/>
<span class="input-group-addon"><i class="fa fa-user"></i></span>
</div>
</div>
</div>
<div class="form-group">
<div class="controls row">
<div class="input-group col-sm-12">
<input type="password" class="form-control" name="password" placeholder="Password"/>
<span class="input-group-addon"><i class="fa fa-key"></i></span>
</div>
</div>
</div>
<div class="row">
<input type="submit" value="submit" class="btn btn-lg btn-primary col-xs-12">
</div>
</fieldset>
</form>
<a class="pull-left" href="auth-layout.ejs#">Forgot Password?</a>
<div class="clearfix"></div>
</div>
</div><!--/row-->
</div>
</div><!--/row-->
It is saved in Auth subfolder but displayed correctly. Signup form looks very similar to it and it works.
replace this:
<form class="form-horizontal login" action="/login" method="POST">.
with this:
<form class="form-horizontal login" action="/auth/local" method="POST">
also you might want to consider to use this tutorial instead: https://www.bearfruit.org/2014/07/21/tutorial-easy-authentication-for-sails-js-apps/
Its alot easier to implement It with that tutorial as it does most of the stuff you did automaticly.
Ok, so the problem was that another service was interfering with AuthController. Anyway thanks for help