As i have build the form and now i want the information directly to my mail inbox, but when client click on send the mailto option comes from the default mailing side , How can i get mail direct on my email when the client fill the contact us form as the code is bellow, and the link of the page is contact us link
<form class="well form-horizontal" action="" method="post" id="contact_form">
<fieldset>
<!-- Form Name -->
<legend class="ContactUsHeading">Contact Us !</legend>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label">First Name</label>
<div class="col-md-4 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
<input name="first_name" placeholder="First Name" class="form-control" type="text">
</div>
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" >Last Name</label>
<div class="col-md-4 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
<input name="last_name" placeholder="Last Name" class="form-control" type="text">
</div>
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label">E-Mail</label>
<div class="col-md-4 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-envelope"></i></span>
<input name="email" placeholder="E-Mail Address" class="form-control" type="text">
</div>
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label">Phone #</label>
<div class="col-md-4 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-earphone"></i></span>
<input name="phone" placeholder="(845)555-1212" class="form-control" type="text">
</div>
</div>
</div>
<!-- Text input-->
<!-- Text input-->
<!-- Select Basic -->
<!-- Text input-->
<!-- Text input-->
<!-- radio checks -->
<div class="form-group">
<label class="col-md-4 control-label">Your</label>
<div class="col-md-4">
<div class="radio">
<label>
<input type="radio" name="Company" value="yes" /> Company
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="company" value="no" /> Individual
</label>
</div>
</div>
</div>
<!-- Text area -->
<div class="form-group">
<label class="col-md-4 control-label">Project Description</label>
<div class="col-md-4 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-pencil"></i></span>
<textarea class="form-control" name="comment" placeholder="Project Description"></textarea>
</div>
</div>
</div>
<!-- Success message -->
<div class="alert alert-success" role="alert" id="success_message">Success <i class="glyphicon glyphicon-thumbs-up"></i> Thanks for contacting us, we will get back to you shortly.</div>
<!-- Button -->
<div class="form-group">
<label class="col-md-4 control-label"></label>
<div class="col-md-4">
<button type="submit" class="btn btn-primary" >Send <span class="glyphicon glyphicon-send"></span></button>
</div>
</div>
</fieldset>
</form>
</div>
<!-- /.container -->
Related
This is the html code for the main page with the popup
<div class="box">
<a class="button" href="#divOne">
<img src="~/images/usericon.png" alt="user" width="30" height="30" />
</a>
</div>
<div class="overlay" id="divOne">
<div class="wrapper">
<div id="container">
<div class="btn" id="btn-1" data-showbutton="1">Login</div>
<div data-button="1">
×
<div class="content">
<div class="container text-active">
#* load page content here*#
<form id="login">
<label>Username</label>
<input type="text" placeholder="Username" />
<label>Password</label>
<input type="text" placeholder="Password" />
</form>
</div>
</div>
<button>Login</button>
</div>
<div class="btn" id="btn-2" data-showbutton="2">Register</div>
<div id="is-hidden" data-button="2">
×
<div class="content">
<div class="container">
<div class="container text-active">
#* load page content here*#
<form id="register">
<label>Username</label>
<input type="text" placeholder="Username" />
<label>Password</label>
<input type="text" placeholder="Password" />
<label>Confirm Password</label>
<input type="text" placeholder="Confirm Password" />
</form>
</div>
</div>
</div>
<button>Register</button>
</div>
</div>
</div>
</div>
This is the page content I want to display inside the popup
#model Store.Models.CustomerModel
#{
ViewData["Title"] = "Register";
}
#* this part is what I need*#
<div class="row">
<div class="col-md-4">
<form asp-action="Register">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<div class="form-group">
<label asp-for="CustomerEmail" class="control-label"></label>
<input asp-for="CustomerEmail" class="form-control" />
<span asp-validation-for="CustomerEmail" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="CustomerPassword" class="control-label"></label>
<input asp-for="CustomerPassword" class="form-control" />
<span asp-validation-for="CustomerPassword" class="text-danger"></span>
</div>
<div class="form-group">
<input type="submit" value="Create" class="btn btn-primary" />
</div>
</form>
</div>
</div>
#* this part is what I need*#
I've tried in including the model and pasting the code and it works, but I want to have that separation between the main page and the login and register form.
This is how it looks, if it is even needed
Move the duplicated code to a partial, with its #model set to CustomerModel:
#model CustomerModel
<div class="row">
<div class="col-md-4">
<form asp-action="Register">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<div class="form-group">
<label asp-for="CustomerEmail" class="control-label"></label>
<input asp-for="CustomerEmail" class="form-control" />
<span asp-validation-for="CustomerEmail" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="CustomerPassword" class="control-label"></label>
<input asp-for="CustomerPassword" class="form-control" />
<span asp-validation-for="CustomerPassword" class="text-danger"></span>
</div>
<div class="form-group">
<input type="submit" value="Create" class="btn btn-primary" />
</div>
</form>
</div>
</div>
In the main page, you need to add a CustomerModel property e.g.
public CustomerModel Customer { get; set; }
and then pass it to the partial, which you can do using a partial tag helper:
<div class="overlay" id="divOne">
<div class="wrapper">
<div id="container">
<div class="btn" id="btn-1" data-showbutton="1">Login</div>
<div data-button="1">
×
<div class="content">
<div class="container text-active">
#* load page content here*#
<partial name="_RegisterForm" for="Customer" />
#* load page content here*#
</div>
</div>
</div>
<button>Register</button>
</div>
</div>
</div>
In the Customer page, you include the partial again, but you don't need to specify a model via the for attribute in the partial because the host page's model will be passed by default:
#page
#model WebApplication4.Pages.CustomerModel
#{
ViewData["Title"] = "Register";
}
#* this part is what I need*#
<partial name="_RegisterForm" />
#* this part is what I need*#
I have this file upload form
#model FileUploadViewModel
#{
ViewData["Title"] = "Index";
}
<h4>Start Uploading Files Here</h4>
<hr />
#if (ViewBag.Message != null)
{
<div class="alert alert-success alert-dismissible" style="margin-top:20px">
#ViewBag.Message
</div>
}
<form enctype="multipart/form-data" asp-controller="files" asp-action="UploadToFileSystem" method="post">
<div class="form-group row">
<label asp-for="Name" class="col-sm-2 col-form-label"></label>
<div class="col-sm-10">
<input asp-for="Name" class="form-control" placeholder="name" />
<span asp-validation-for="Name" class="text-danger"></span>
</div>
</div>
<div class="form-group row">
<label asp-for="Author" class="col-sm-2 col-form-label"></label>
<div class="col-sm-10">
<input asp-for="Author" class="form-control" placeholder="Author" />
<span asp-validation-for="Author" class="text-danger"></span>
</div>
</div>
<div class="form-group row">
<label asp-for="Genre" class="col-sm-2 col-form-label"> </label>
<div class="col-sm-10">
<select asp-for="Genre" class="custom-select mr-sm-2" asp-items="Html.GetEnumSelectList<Genres>()" ></select>
</div>
</div>
<div class="form-group row">
<label asp-for="Description" class="col-sm-2 col-form-label"></label>
<div class="col-sm-10">
<input asp-for="Description" class="form-control" placeholder="Description" />
<span asp-validation-for="Description" class="text-danger"></span>
</div>
</div>
<div class="form-group row " >
<label asp-for="PublishedOn" class="col-sm-2 col-form-label"></label>
<div class="col-sm-10">
<input type="date" asp-for="PublishedOn" class="form-control" placeholder="Publishing Date" />
<span asp-validation-for="PublishedOn" class="text-danger"></span>
</div>
</div>
<div class="form-group row">
<label asp-for="Files" class="col-sm-2 col-form-label"></label>
<div class="col-sm-10">
<div class="custom-file">
<input asp-for="Files" multiple type="file" class="form-control custom-file-input" placeholder="file" />
<label class="custom-file-label">Chose File...</label>
<span asp-validation-for="Files" class="text-danger"></span>
</div>
</div>
</div>
<button class="btn btn-success" type="submit" asp-action="UploadToFileSystem" asp-controller="Files">Upload</button>
</form>
#section Scripts{
<script>
$(document).ready(function () {
$('.custom-file-input').on("change", function () {
var fileLabel = $(this).next('.custom-file-label');
var files = $(this)[0].files;
if (files.length > 1) {
fileLabel.html(files.length + 'files selected');
}
else if (files.length == 1) {
fileLabel.html(files[0].name);
}
});
});
</script>
}
I want to make dropdown list with this table from postgresql database
FileTypes table in pgadmin
And i have this table for genres in database
Genres table in pgadmin
So if i pick FileType with ID=1 in first dropdown,in the second dropdown i want to show only genres with with FileTypeID=1,I try to fill the genres table manualy but i have error(will be posted below).Any help for this way,or other way to filter genres dropdown depends on file type selected in first dropdown.Error trying to fill rows in Genre table
Based on that error, you didn't create a foreign key but a unique index on that column in the Genre table. They prefix IX for index and FK for foreign keys by default I believe. Check your table relationships and check IX_genres_FileTypesID and I am pretty sure you will see the relationship isn't there.
I have a large number of web pages and each of these pages is the specifications of the drug. I want to display all the drug information from the first to the last, which contains 13 fields in the box list, respectively. It does not find the class value when I use the following code
<div class="row">
<span class="titleSearch">
<img src="/content/Images/pointSearchDetail.jpg" /> info
</span>
</div>
<div class="borderSearchDetail"><span class="borderMinSearch" /></div>
<br />
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 padding0">
<div class="row">
<div class="col-lg-5 col-md-5 col-sm-6 col-xs-12">
<label class="txtSearch colorBlack">name :</label>
<span class="txtAlignLTR">
METHYLPREDNISOLONE ACETATE
</span>
</div>
<div class="col-lg-7 col-md-7 col-sm-12 col-xs-12">
<label class="txtSearch colorBlack">public name :</label>
<bdo class="txtAlignLTR">
METHYLPREDNISOLONE ACETATE INJECTION, SUSPENSION PARENTERAL 40 mg/1mL
</bdo>
</div>
</div>
<div class="row">
<div class="col-lg-5 col-md-5 col-sm-6 col-xs-12">
<label class="txtSearch colorBlack">oxr :</label>
<span class="txtAlignLTR">
INJECTION, SUSPENSION
</span>
</div>
<div class="col-lg-5 col-md-5 col-sm-6 col-xs-12">
<label class="txtSearch colorBlack"> masraf :</label>
<bdo class="txtAlignLTR">
PARENTERAL
</bdo>
</div>
</div>
<div class="row">
<div class="col-lg-5 col-md-5 col-sm-6 col-xs-12">
<label class="txtSearch colorBlack">company:</label>
<span class="txtSearch1">
alborz
</span>
</div>
<div class="col-lg-5 col-md-5 col-sm-6 col-xs-12">
<label class="txtSearch colorBlack">brand company :</label>
<span class="txtAlignLTR">
alborz <img src="/content/Images/CountriesFlag/IR.gif" style="visibility: visible" title="iran" />
</span>
</div>
</div>
<div class="row">
<div class="col-lg-5 col-md-5 col-sm-6 col-xs-12">
<label class="txtSearch colorBlack">Creator :</label>
<span class="txtAlignLTR">
alborz
</span>
</div>
<div class="col-lg-5 col-md-5 col-sm-6 col-xs-12">
<label class="txtSearch colorBlack">date :</label>
<span class="txtAlignLTRFa">
1397/12/24
</span>
</div>
</div>
<div class="row">
<div class="col-lg-5 col-md-5 col-sm-6 col-xs-12">
<label class="txtSearch colorBlack">cost :</label>
<span class="txtAlignLTRFa priceTxt">
49500
</span>
<span class="txtAlignLTR">
ریال
</span>
</div>
<div class="col-lg-5 col-md-5 col-sm-12 col-xs-12">
<label class="txtSearch colorBlack">cost 2 :</label>
<span class="txtAlignLTRFa priceTxt">
49500
</span>
<span class="txtAlignLTR">
$
</span>
</div>
</div>
<div class="row">
<div class="col-lg-5 col-md-5 col-sm-6 col-xs-12">
<label class="txtSearchEnglish-ltr colorBlack">:GTIN </label>
<span class="txtAlignLTRFa">
06260152433031
</span>
</div>
<div class="col-lg-5 col-md-5 col-sm-6 col-xs-12">
<label class="txtSearchEnglish-ltr colorBlack">:IRC </label>
<span class="txtAlignLTRFa">
3230858996456396
</span>
</div>
</div>
<div class="row">
<div class="col-lg-5 col-md-5 col-sm-6 col-xs-12">
<label class="txtSearch colorBlack">count: </label>
<bdo class="txtAlignLTR">
1 AMPULE in 1 CARTON
</bdo>
</div>
I'm looking to get variables and write them in the list box .
and i use the code C#
HtmlElementCollection doc1 = webBrowser1.Document.GetElementsByTagName("class");
foreach (HtmlElement i in doc1)
{
try
{
listBox1.Items.Add(i.InnerText);
button1.Text = listBox1.Items.Count.ToString();
}
catch { }
}
but not fond Class :(. What is the solution?
There is no <class> in "your" page; and you are searching exactly a tag with the name class, that's why you cannot find anything.
If you are using selenium i suggest you to use the WebDriver.
Even if I think you don't need this locator, to extract every tag with a class you can do something like:
foreach(WebElement we in webdriver.findElements(By.cssSelector("*[class]")))
{
listBox1.Items.Add(we.InnerText);
button1.Text = listBox1.Items.Count.ToString();
}
Probably you will need to find the best parent element and then, for each, search the nested values you want.
To understand which selector to use i suggest you this very nice cheat sheet.
Submit button doesn't submit out of a sudden in ASP.NET MVC when creating a new user when it worked previously. It did not show any invalid input or valid input. I'm not sure where the problem went wrong. Any suggestion would be helpful.This problem has been happening twice and the solution that I have done so far is recreating a new project which I think is not practical.
Here is my code to review.
Admincontroller.cs
[HttpPost]
public IActionResult CreateUser(Users usr)
{
// TODO: L09 Task 5 - Write secure code to insert TravelUser into database
if (!ModelState.IsValid)
{
ViewData["Message"] = "Invalid Input";
ViewData["MsgType"] = "warning";
return View("CreateUser");
}
else
{
string insert = #"INSERT INTO WBUsers(UserId, UserPw,FullName, Email, UserRole,Dob,ContactNo,usr.Billing_Address)
VALUES('{0}', HASHBYTES('SHA1','{1}'),'{2}','{3}','{4}','{5}',{6},'{7}')";
// TODO: L10 Task 2a - Provide the SQL statement to reset member"
if (DBUtl.ExecSQL(insert, usr.UserId, usr.UserPw, usr.FullName, usr.Email, usr.UserRole, usr.Dob, usr.ContactNo, usr.Billing_Address) == 1)
{
string template = #"Hi {0},<br/><br/>
Welcome to Ecommerce!
Your userid is <b>{1}</b> and password is <b>{2}</b>. Please change your password upon login.
<br/><br/>Adminstrator";
string title = "Account Sign Up";
string message = String.Format(template, usr.FullName, usr.UserId, usr.UserPw);
string result = "";
bool outcome = false;
// TODO: L10 Task 2b - Call EmailUtl.SendEmail to send email
// Uncomment the following line with you are done
outcome = EmailUtl.SendEmail(usr.Email, title, message, out result);
if (outcome)
{
ViewData["Message"] = "Account Has Been Created";
ViewData["MsgType"] = "success";
}
else
{
ViewData["Message"] = result;
ViewData["MsgType"] = "warning";
}
}
else
{
ViewData["Message"] = DBUtl.DB_Message;
ViewData["MsgType"] = "danger";
}
return View("CreateUser");
}
}
CreateUser.cshtml
#model SignUp2.Models.Users;
<link href="~/lib/dtpicker/css/tempusdominus-bootstrap-4.min.css" rel="stylesheet" />
<script src="~/lib/dtpicker/js/tempusdominus-bootstrap-4.min.js"></script>
<link href="~/lib/font-awesome/css/font-awesome.min.css" rel="stylesheet" />
<script language="javascript">
$(document).ready(function () {
// DateA
$('#JSDateA')
.datetimepicker({ format: 'YYYY-MM-DD' });
});
</script>
<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="~/lib/styles/createform.css">
</head>
<body>
<div class="center">
<form asp-controller="Admin" asp-action="CreateUser" method="post">
<h3>Registration Form</h3>
<div class="form-group row">
<label class="control-label col-sm-3" asp-for="UserId">Username:<span style="color:red;">*</span></label>
<div class="col-sm-5">
<input asp-for="UserId" placeholder="User ID" class="form-control" />
</div>
<div class="col-sm-3">
<span asp-validation-for="UserId" class="text-danger"></span>
</div>
</div>
<div class="form-group row">
<label class="control-label col-sm-3" asp-for="FullName">Full Name:<span style="color:red;">*</span> </label>
<div class="col-sm-5">
<input asp-for="FullName" placeholder="Full Name" class="form-control" />
</div>
<div class="col-sm-3">
<span asp-validation-for="FullName" class="text-danger"></span>
</div>
</div>
<div class="form-group row">
<label class="control-label col-sm-3" asp-for="Email">Email:<span style="color:red;">*</span> </label>
<div class="col-sm-5">
<input asp-for="Email" placeholder="Email" class="form-control" />
</div>
<div class="col-sm-3">
<span asp-validation-for="Email" class="text-danger"></span>
</div>
</div>
<div class="form-group row">
<label class="control-label col-sm-3" asp-for="UserPw">Password:<span style="color:red;">*</span> </label>
<div class="col-sm-5">
<input asp-for="UserPw" placeholder="Password" class="form-control" />
</div>
<div class="col-sm-3">
<span asp-validation-for="UserPw" class="text-danger"></span>
</div>
</div>
<div class="form-group row">
<label class="control-label col-sm-3" asp-for="Dob">Birth Date:<span style="color:red;">*</span></label>
<div class="col-sm-5">
<input asp-for="Dob" asp-format="{0:yyyy-MM-dd}"
class="form-control" placeholder="YYYY-MM-DD" />
</div>
<span asp-validation-for="Dob" class="text-danger"></span>
</div>
<div class="form-group row">
<label class="control-label col-sm-3" asp-for="ContactNo">Contact Number:<span style="color:red;">*</span></label>
<div class="col-sm-5">
<input asp-for="ContactNo" class="form-control" placeholder="Contact Number" />
</div>
<div class="col-sm-3">
<span asp-validation-for="ContactNo" class="text-danger"></span>
</div>
</div>
<div class="form-group row">
<label class="control-label col-sm-3" asp-for="Billing_Address">Billing Address:<span style="color:red;">*</span> </label>
<div class="col-sm-5">
<input asp-for="Billing_Address" class="form-control" placeholder="Billing Address" />
</div>
<div class="col-sm-3">
<span asp-validation-for="Billing_Address" class="text-danger"></span>
</div>
</div>
<div class="form-group row">
<label class="control-label col-sm-3">User Role:<span style="color:red;">*</span> </label>
<div class="col-sm-6">
<div class="form-check form-check-inline">
<input type="radio" class="form-check-input" id="rb1"
asp-for="UserRole" value="user" checked />
<label class="form-check-label" for="rb1">User</label>
</div>
<div class="form-check form-check-inline">
<input type="radio" class="form-check-input" id="rb2"
asp-for="UserRole" value="admin" />
<label class="form-check-label" for="rb2">Admin</label>
</div>
</div>
</div>
<div class="form-group row">
<div class="offset-sm-3 col-sm-6">
<input type="submit" value="Submit" class="btn btn-primary" />
</div>
</div>
#if (ViewData["Message"] != null)
{
<div class="form-group row">
<div class="offset-sm-2 col-sm-6">
<div class="alert alert-#ViewData["MsgType"]">
#Html.Raw(ViewData["Message"])
</div>
</div>
</div>
}
</form>
</div>
</body>
I have three tabs on the form but I have sep elements on the form however I have a partial view loaded in between the main elements which has its own form
Obv I could have the one form tag to contain the main elements but how would I handle my sep view in this case as at present the main form tag would overide it
Edit 2
The main problem I am having is that when I load the partial view the main modal is not being filled as I have not told it to go to a controller to perform some linq my main question is how do i do this.
<div class="col-md-10">
<div class="nav-tabs-custom">
<ul class="nav nav-tabs">
<li class="active">Product Info</li>
<li>Product Images</li>
<li>Seo</li>
<li>Settings</li>
</ul>
<div class="tab-content">
<div class="active tab-pane" id="productInfo">
<!-- Horizontal Form -->
<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title">Horizontal Form</h3>
</div>
<!-- /.box-header -->
<!-- form start -->
<div class="box-body">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<div class="form-group">
<label for="inputPassword" class="col-sm-2 control-label">Product Name</label>
<div class="col-sm-10">
<input type="text" asp-for="ProductName" class="form-control" id="productName">
</div>
</div>
<div class="form-group">
<label asp-for="SKU" class="col-sm-2 control-label">Product Sku</label>
<div class="col-sm-10">
<input asp-for="SKU" class="form-control" />
<span asp-validation-for="SKU" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<label asp-for="LongDescription" class="col-sm-2 control-label">Product Description</label>
<div class="col-sm-10">
<textarea id="editor1" class="form-control"></textarea>
<span asp-validation-for="LongDescription" class="text-danger"></span>
</div>
</div>
<div class="row">
<div class="col-xs-2">
<div class="input-group">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-gbp"></i></span>
<input type="text" asp-for="OldPrice" placeholder="Price" class="form-control">
</div>
</div>
<!-- /input-group -->
</div>
<!-- /.col-lg-6 -->
<div class="col-xs-2">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-gbp"></i></span>
<input type="text" asp-for="OldPrice" placeholder="Old Price" class="form-control">
</div>
<!-- /input-group -->
</div>
<!-- /.col-lg-6 -->
</div>
</form>
</div>
<!-- /.tab-pane -->
</div>
</div>
<div class="tab-pane" id="images">
Product Images
#await Html.PartialAsync("_ProductPicture", Model)
</div>
<div class="tab-pane" id="seo">
</div>
</div>
This is my partial view which is loaded from the above.
#model solitude.models.Models.ViewModels.ProductImageVm
#*
For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860
*#
#Html.PartialAsync("_ProductPicturesList.cshtml")
<div class="form-group">
<form asp-controller="Products" asp-action="FileUpload" asp-route-returnurl="#ViewData["ReturnUrl"]" enctype="multipart/form-data" method="post" class="form-horizontal" role="form">
<input asp-for="Title" />
<input asp-for="ProductId" type="hidden" />
<input asp-for="Image" />
<input type="submit" />
</form>
</div>