Notice: file_put_contents(): Write of 5810 bytes failed with errno=28 No space left on device in /var/www/tgoop/post.php on line 50

Warning: file_put_contents(): Only 12288 of 18098 bytes written, possibly out of free disk space in /var/www/tgoop/post.php on line 50
Web Devs@fullStackDevs P.477
FULLSTACKDEVS Telegram 477
#Remote_attribute

🔹 حتما تاکنون برای شما پیش آمده است که در هنگام ثبت نام در سایتی در هنگام وارد کردن ایمیل با Validation ارور هایی مبتنی بر تکراری بودن آدرس ایمیل بدون Submit کردن اطلاعات فرم دریافت کرده باشید.
راه حل انجام این کار بسیار آسان است. استفاده از Remote اتریبیوت بر بالای پراپرتی ای در ویو مدل که میخواهید برای آن Remote Validation به سرور بزنید.

▪️Remote Attribute

🔸این attribute این امکان را به برنامه نویس میدهد که با یک اسکریپت در سمت کلاینت (استفده از ایجکس) اکشن متدی را در سمت سرور صدا بزند و نتیجه را دریافت کند.

public class User
{
[Required]
[DataType(DataType.EmailAddress)]
[Remote("ValidateEmailAddress","Home")]
public string Email { get; set; }
}

🔸 در کد بالا ValidateEmailAddress اکشنی است درون Homecontroller که در صورت وجود داشتن ایمیل مشابه در دیتابیس مقدار True را باز میگرداند.

public IActionResult ValidateEmailAddress(string email)
{
return
Json(_repository.CheckEmailExists(email) ?
"true" : string.Format("an account for address {0} already exists.", email));
}

🔻در سمت کلاینت هم جز افزودن لایبری های مورد نیاز ، دیگر لازم به انجام کاری نیست .

<script src="~/Scripts/jquery.js"></script>
<script src="~/Scripts/jquery.validate.js"></script>
<script src="~/Scripts/additional-methods.js"></script>
<script src="~/Scripts/jquery.validate.unobtrusive.js"></script>

<form asp-action="SignIn" asp-controller="home" class="form-horizontal">

<div class="form-group">

<label asp-for="Email" class="col-sm-2 control-label">Subscribe</label>
<div class="col-sm-10">
<input type="email" class="form-control" asp-for="Email" placeholder="Email address" />
<span asp-validation-for="Email"></span>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default">Sign in</button>
</div>
</div>
</form>

@FullStackDevs



tgoop.com/fullStackDevs/477
Create:
Last Update:

#Remote_attribute

🔹 حتما تاکنون برای شما پیش آمده است که در هنگام ثبت نام در سایتی در هنگام وارد کردن ایمیل با Validation ارور هایی مبتنی بر تکراری بودن آدرس ایمیل بدون Submit کردن اطلاعات فرم دریافت کرده باشید.
راه حل انجام این کار بسیار آسان است. استفاده از Remote اتریبیوت بر بالای پراپرتی ای در ویو مدل که میخواهید برای آن Remote Validation به سرور بزنید.

▪️Remote Attribute

🔸این attribute این امکان را به برنامه نویس میدهد که با یک اسکریپت در سمت کلاینت (استفده از ایجکس) اکشن متدی را در سمت سرور صدا بزند و نتیجه را دریافت کند.

public class User
{
[Required]
[DataType(DataType.EmailAddress)]
[Remote("ValidateEmailAddress","Home")]
public string Email { get; set; }
}

🔸 در کد بالا ValidateEmailAddress اکشنی است درون Homecontroller که در صورت وجود داشتن ایمیل مشابه در دیتابیس مقدار True را باز میگرداند.

public IActionResult ValidateEmailAddress(string email)
{
return
Json(_repository.CheckEmailExists(email) ?
"true" : string.Format("an account for address {0} already exists.", email));
}

🔻در سمت کلاینت هم جز افزودن لایبری های مورد نیاز ، دیگر لازم به انجام کاری نیست .

<script src="~/Scripts/jquery.js"></script>
<script src="~/Scripts/jquery.validate.js"></script>
<script src="~/Scripts/additional-methods.js"></script>
<script src="~/Scripts/jquery.validate.unobtrusive.js"></script>

<form asp-action="SignIn" asp-controller="home" class="form-horizontal">

<div class="form-group">

<label asp-for="Email" class="col-sm-2 control-label">Subscribe</label>
<div class="col-sm-10">
<input type="email" class="form-control" asp-for="Email" placeholder="Email address" />
<span asp-validation-for="Email"></span>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default">Sign in</button>
</div>
</div>
</form>

@FullStackDevs

BY Web Devs


Share with your friend now:
tgoop.com/fullStackDevs/477

View MORE
Open in Telegram


Telegram News

Date: |

How to create a business channel on Telegram? (Tutorial) Those being doxxed include outgoing Chief Executive Carrie Lam Cheng Yuet-ngor, Chung and police assistant commissioner Joe Chan Tung, who heads police's cyber security and technology crime bureau. While the character limit is 255, try to fit into 200 characters. This way, users will be able to take in your text fast and efficiently. Reveal the essence of your channel and provide contact information. For example, you can add a bot name, link to your pricing plans, etc. Administrators With the sharp downturn in the crypto market, yelling has become a coping mechanism for many crypto traders. This screaming therapy became popular after the surge of Goblintown Ethereum NFTs at the end of May or early June. Here, holders made incoherent groaning sounds in late-night Twitter spaces. They also role-played as urine-loving Goblin creatures.
from us


Telegram Web Devs
FROM American