Contact form doesnt send email, Error page - html

Hi I really need help with this.
I have just finished a design for a client and her website went live on Thursday, however the contact form doesn't work. I do know things about HTML/CSS but I am very basic with stuff with script. When you fill in the form and press send a 'not found' page appears.
Whats gone wrong?
I have tried looking at other posts about this kind of thing but I think the code needs looking at.
Much appreciated
//email form validation
function everif(str) {
var at="#"
var punct="."
var lat=str.indexOf(at)
var lstr=str.length
var lpunct=str.indexOf(punct)
if (str.indexOf(at)==-1){
alert("Valid email must be entered")
return false
}
if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
alert("Valid email must be entered")
return false
}
if (str.indexOf(punct)==-1 || str.indexOf(punct)==0 || str.indexOf(punct)==lstr){
alert("Valid email must be entered")
return false
}
if (str.indexOf(at,(lat+1))!=-1){
alert("Valid email must be entered")
return false
}
if (str.substring(lat-1,lat)==punct || str.substring(lat+1,lat+2)==punct){
alert("Valid email must be entered")
return false
}
if (str.indexOf(punct,(lat+2))==-1){
alert("Valid email must be entered")
return false
}
if (str.indexOf(" ")!=-1){
alert("Valid email must be entered")
return false
}
return true
}
function evalid(){
var emailID=document.contact_form.mail
if (everif(emailID.value)==false){
emailID.focus()
return false
}
//empty field validation
var fname=document.contact_form.fname
if ((fname.value==null)||(fname.value=="")){
alert("Fields marqued with * must be entered")
fname.focus()
return false
}
var lname=document.contact_form.lname
if ((lname.value==null)||(lname.value=="")){
alert("Fields marqued with * must be entered")
lname.focus()
return false
}
var message=document.contact_form.message
if ((message.value==null)||(message.value=="")){
alert("Fields marqued with * must be entered")
message.focus()
return false
}
return true
}
</script>
<form name="contact_form" method="post" action="mailer.php" onSubmit="return evalid()">
<table border="0"><tr>
<td colspan="2"><input name="fname" type="text" value="First Name" size="40" /></td>
</tr><tr>
<td colspan="2"><input name="lname" type="text" value="Last Name" size="40" /></td>
</tr><tr>
<td colspan="2"><input type="text" value="Email" name="mail" size="40" /></td>
</tr><tr>
<td colspan="2"><textarea name="message" value="Your Message" onkeyup="return limitarelungime(this, 255)" cols="35" rows="5"></textarea></td>
</tr><tr>
<td></td>
<td colspan="2"></td>
</tr>
<tr>
<td align="right">
<input type="image" src="images/send.png" value="Submit" alt="submit" name="submit"/>
</td>
<td align="right"><alt="Valid Contact Form" width="20" height="20" border="0" /></a></td>
</tr>
</table>
</form>
</div>

Page not found error suggests that there is some problem with the URL redirect quite simply or the file does not exist. In your case if the form is sending the data to a mailer.php script, just make sure that the path of the file is entered correctly and that the file is there in a particular folder according to the path. Your problem should be solved.

Related

Pass textbox variables to query Google Sheets

I'm designing a "SIMPLE" web app, I want to query the sheet using the user's response( captured in the html textbox) and then display the cells that match in the HTML page, but the issue is wiring the submit button to return the results
function doGet(e) {
return HtmlService
.createTemplateFromFile('frontend')
.evaluate()
.setSandboxMode(HtmlService.SandboxMode.NATIVE)
}
And in the html I have basically
<tr>
<td>Search name: </td>
<td><input type="text" name="Name" /></td>
</tr>
<input type="submit" onclick="google.script.run.do_it(??????)">
How do I send the textbox variables to Apps Script?
The input needs to be inside a form, and then you pass the form text input as this.parentNode (it's an object)
<form id="myForm">
<table>
<tr><td>First Name</td><td><input type="textbox" size="100" name="first" required> </td></tr>
<tr><td>Last Name</td><td><input type="textbox" size="100" name="last" required> </td></tr>
</table>
<br><br>
<input type="button" id="load" value="Start" onclick="inputForm(this.parentNode)"
style="padding:5px;color: #fff; border-color: white;"/>
</form>
inside the function you pass the form to, you can access the variables in the object like this
inputForm(e){
Logger.log(e.first);
Logger.log(e.last);
}
Does that give you enough to get started?

AngularJs File Upload in asp.net mvc

here is what I've tried till now
I cant send that file to my action result, its showing me null,
<form ng-show="divPatient" name="PatientForm" ng-submit="AddUpdatePatient()">
<table>
<tr>
<td>
<input class="form-control" type="text" readonly placeholder="Key (Automatic)" ng-model="PatientID" />
</td>
<td>
<input id="FormFocus" name="FirstName" class="form-control" type="text" placeholder="FirstName" ng-model="FirstName" ng-minlength="3" required />
</td>
<td>
<input name="LastName" class="form-control" type="text" placeholder="LastName" ng-model="LastName" ng-minlength="3" required />
</td>
<td>
<input class="form-control" type="text" placeholder="Disease" ng-model="Disease" name="Disease" ng-minlength="3" required />
</td>
<td>
<input class="form-control" type="number" placeholder="Phone No." ng-model="PhoneNo" name="PhoneNo" ng-pattern="/^[789]\d{9}$/" required />
</td>
<td>
<input type="file" onchange="angular.element(this).scope().selectFileforUpload(this.files)" accept="image/*" class="form-control" ng-model="PhotoURL" value="{{PhotoURL}}" required />
</td>
<td colspan="2">
<input type="submit" value="save" class="btn btn-success" ng-disabled="PatientForm.PhoneNo.$dirty && PatientForm.PhoneNo.$invalid || PatientForm.LastName.$dirty && PatientForm.LastName.$invalid || PatientForm.FirstName.$dirty && PatientForm.FirstName.$invalid || PatientForm.Disease.$dirty && PatientForm.Disease.$invalid" />
<input type="button" value="cancel" class="btn btn-primary" ng-click="CancelForm()" />
</td>
</tr>
<tr>
<td></td>
<td><span class="eror-text" ng-show="PatientForm.FirstName.$error.minlength">min 3 letters</span></td>
<td><span class="eror-text" ng-show="PatientForm.LastName.$error.minlength">min 3 letters</span></td>
<td><span class="eror-text" ng-show="PatientForm.Disease.$error.minlength">min 3 letters</span></td>
<td><span class="eror-text" ng-show="PatientForm.PhoneNo.$error.pattern">Invalid phone no</span></td>
</tr>
</table>
</form>
$scope.selectFileforUpload = function (files) {
$scope.selectedFile = files;
}
$scope.AddUpdatePatient = function () {
var file = $scope.selectedFile[0];
var Patient = {
FirstName: $scope.FirstName,
LastName: $scope.LastName,
Disease: $scope.Disease,
PhoneNo: $scope.PhoneNo
};
var getData = angularService.AddPatient(Patient,filee);
getData.then(function (msg) {
GetAllPatients();
alert(msg.data);
$scope.divPatient = false;
}, function () {
alert('Error in adding record');
});
}
here is my service code
this.AddPatient = function (patient, file) {
// this showing me file object thats fine
alert("in services" + filee);
// i think something wrong here we shouldn't or can't send the file to actionresult like this
var response = $http({
method: "post",
url: "AddPatient",
data: JSON.stringify(patient),
dataType: "json",
// something wrong here ??
file : file
});
return response;
}
amd last my method in my controller
public string AddPatient(Patient patient,HttpPostedFileBase file)
{
// I'm getting patient data that is fine, but file is showing me null
}
is anything wrong with my service method ??? or do you know how to send form along with files to actionresult or any method in the mvc controller, i heard some pleople do it by using "new FormData", but i dont know that, but i'm willing to learn it or use it, if that solves my problem

HTML code for button click limitation

This is my code, and it's for SMS spoofing service. I need a system, which will control how many SMS messages can user send. For example every user has 5 messages to send, and all above 5 is forbiden.
I need you to help me to make a simple HTML code, which will show me the message like "It's enough" when they click submit button more then 5 times.
<tr>
<td>Password:</td>
<td><input type="password" name="pass" placeholder="toro"></td>
</tr>
<tr>
<td>To: </td>
<td><input type="text" name="to" size="30" placeholder="+38164,+38162 etc..." /></td>
</tr>
<tr>
<td>From: </td>
<td><input type="text" name="from" size="30" placeholder="Facebook, 911 etc... " /></td>
<tr>
<td>Message: </td>
<td><textarea name="message"></textarea></td>
</tr>
<tr>
<td><input type="submit" name="submit" /></td>
<tr>
Not possible with HTML. Can be done with jquery or javascript as below. But my suggestion would be to have a counter in server side. Because, if the page is refreshed, the counter would be reset and again SMS would be able to be sent for another 5 more times and the cycle continues.. This is not proper restriction to have only client side check.
<script>
var clickcount = 0;
var maxlimit = 5;
$(document).ready(function() {
$("#btnSubmit").click(function(){
if (clickcount >=maxlimit)
{
alert ("Sorry, You have used your max limit of "+maxlimit+" sms for the day ");
}
else if ($("#formID").valid())
{
clickcount++;
$("#formID").submit();
}
});
});
</script>

FORM VALIDTION difficulty

I applied validation IN THIS JSP PAGE. If I leave username/password empty, I will be prompted to enter those to fields, but the PROBLEM is that after I press OK on validation prompt,the page goes to 2_control.jsp.I WANT IT TO GO TO THE NEXT PAGE ONLY IF the validation thing is ok,not otherwise.plz hlp.What change should i make?
Here is my code:
<html>
<head>
<script>
function validLogin(){
if (document.form.userName.value == ""){
alert ( "Please enter Login Name." );
document.loginform.userName.focus();
return false;
}
if (document.form.password.value == ""){
alert ( "Please enter password." );
document.userform.password.focus();
return false;
}
alert ( "Welcome User" );
return true;
}
</script>
</head>
<body>
<form name="form" method="post" action="2_control.jsp" onsubmit="return validLogin();">
<table width="250px" border=0 style="background-color:ffeeff;">
<tr><td colspan=2 align="center" style="font-weight:bold;font-size:20pt;" align="center">User Login</td>
</tr>
<tr><td colspan=2> </td>
</tr>
<tr><td style="font-size:12pt;" align="center">Login Name:</td>
<td><input type="text" name="userName" value=""></td>
</tr>
<tr><td style="font-size:12pt;" align="center">Password:</td>
<td><input type="password" name="password" value=""></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="Submit" value="Login"></td>
</tr>
</table>
</form>
</body>
</html>
change document.userform.password.focus(); to document.form.userName.focus();
Change only form name when you focus on text box.. userform is wrong so your validation is not work..
<script>
function validLogin(){
if (document.form.userName.value == ""){
alert ( "Please enter Login Name." );
document.form.userName.focus();
return false;
}
else if (document.form.password.value == ""){
alert ( "Please enter password." );
document.form.password.focus();
return false;
}
}
</script>
Replace this script tag...
You do small mistake in writing form name..

Possible to get html form field values sent to Flex 3 app even once they're changed?

I have a project where a user will go to username.website.com.
Once the page loads, there will be an HTML form that displays whatever information we have on the user in an HTML form. If there is a missing piece of information about the user, they will update it.
There is also a side area that contains a flex 3 application. At the bottom of the flex app, there's a submit button.
I need to make it so that when the user hits the submit button from within the flex app, the current value of the html fields is sent to the flex app so that the html data as well as the data from within the flex app can be transmitted with a URL request.
So basically, when the user hits the submit button within the flex app, I'd like for the data from the html fields as well as the flex fields to be combined and sent.
Here's how I ended up doing it (for any future viewers of the thread):
Actionscript code:
Import the right class:
import flash.external.ExternalInterface;
Create the function to call the JS function
private function getFormValues():void
{
firstName = ExternalInterface.call("getJSVar", "firstName");
lastName = ExternalInterface.call("getJSVar", "lastName");
address = ExternalInterface.call("getJSVar", "address");
phone = ExternalInterface.call("getJSVar", "phone");
email = ExternalInterface.call("getJSVar", "email");
}
(My variables [firstName, lastname, address, phone, and email] are defined as bindable strings)
Create the javascript function to get the latest values, and return them:
<script type="text/javascript">
function getJSVar(varName)
{
var toReturn = "Nothing Sent";
if (varName == "firstName")
toReturn = document.forms["userInfo"].firstName.value;
else if (varName == "lastName")
toReturn = document.forms["userInfo"].lastName.value;
else if (varName == "address")
toReturn = document.forms["userInfo"].address.value;
else if (varName == "phone")
toReturn = document.forms["userInfo"].phone.value;
else if (varName == "email")
toReturn = document.forms["userInfo"].email.value;
return toReturn;
}
</script>
Here's my html form too:
<form action='#' method='post' name="userInfo">
<table width='100%'>
<tr>
<td align='center'><input type='text' id="firstName" name="firstName" value='First Name' style='width:250px;' /></td>
<td align='center'><input type='text' id="ymm" name='ymm' value='Year Make Model' style='width:250px;' /></td>
</tr>
<tr>
<td align='center'><input type='text' id="lastName" name='lastName' value='Last Name' style='width:250px;' /></td>
<td align='center'><input type='text' id="address" name='address' value='Address' style='width:250px;' /></td>
</tr>
<tr>
<td align='center'><input type='text' id="phone" name='phone' value='Phone Number' style='width:250px;' /></td>
<td align='center'><input type='text' id="email" name='email' value='Email Address' style='width:250px;' /></td>
</tr>
</table>
</form>