ASP.NET MVC How to use Ajax.BeginForm? - asp.net

i try to use Asp.net mvc4 Ajax helper and when i submit form it makes full post back.
Notice that i include all important scripts like Jquery and jquery.unobtrusive-ajax inside head element.
<script src="#Url.Content("~/Scripts/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script>
<script src="#Url.Content("~/Scripts/jquery-1.9.1.min.js")" type="text/javascript"> </script>
Students Controller
[HttpPost]
public string Create(Students students)
{
if (Request.IsAjaxRequest())
{
if (ModelState.IsValid)
{
db.Students.Add(students);
db.SaveChanges();
// return RedirectToAction("Index");
}
}
return "<h2>Customer updated successfully!</h2>";
}
Create View
#using (Ajax.BeginForm("Create","Students", new AjaxOptions() { HttpMethod= "POST", UpdateTargetId = "fs1" }))
{
<fieldset id="fs1">
<legend>Students</legend>
<div class="editor-label">
#Html.LabelFor(model => model.ST_NAME)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.ST_NAME)
#Html.ValidationMessageFor(model => model.ST_NAME)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.ST_BIRTH_DATE)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.ST_BIRTH_DATE)
#Html.ValidationMessageFor(model => model.ST_BIRTH_DATE)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.ST_PHONE)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.ST_PHONE)
#Html.ValidationMessageFor(model => model.ST_PHONE)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.ST_ADDR)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.ST_ADDR)
#Html.ValidationMessageFor(model => model.ST_ADDR)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.ST_CLASS)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.ST_CLASS)
#Html.ValidationMessageFor(model => model.ST_CLASS)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.ST_STAT)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.ST_STAT)
#Html.ValidationMessageFor(model => model.ST_STAT)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.LAST_UPDATE_DATE)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.LAST_UPDATE_DATE)
#Html.ValidationMessageFor(model => model.LAST_UPDATE_DATE)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.CURRENT_CLASS_GRADE)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.CURRENT_CLASS_GRADE)
#Html.ValidationMessageFor(model => model.CURRENT_CLASS_GRADE)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.CURRENT_CLASS)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.CURRENT_CLASS)
#Html.ValidationMessageFor(model => model.CURRENT_CLASS)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.ST_CODE)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.ST_CODE)
#Html.ValidationMessageFor(model => model.ST_CODE)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.REG_CLASS)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.REG_CLASS)
#Html.ValidationMessageFor(model => model.REG_CLASS)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.IDNO)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.IDNO)
#Html.ValidationMessageFor(model => model.IDNO)
</div>
<p>
<input type="submit" value="Create" />
</p>
</fieldset>
}
Notice that when i check if the request is ajax it gave me false.

Related

How can I access items on PopUp Edit window on Kendo grid?

I've a Contact page, where a user can maintain it. Using Kendo grid, I listed the contact on my initial grid with only few columns. When the user clicks edit button, a PopUp comes up so edit/delete can be performed. However, the contact table has 3 foreign keys (AccountId, StateProvinceId, CountryRegionId) that show up as dropdown list on the main grid but not on the PopUp window. How can I populate these dropdown on Popup edit mode and disable some fields?
#model Humana.Billings.Web.Models.ContactModel
#using Humana.Billings.Web.Helpers;
#using System.Collections;
<div>
#(Html.Kendo().Grid<ContactModel>()
.Name(Constants.ContactGridId)
.EnableCustomBinding(true)
.Sortable()
.Columns(c =>
{
c.Bound(e => e.ContactId).Width(50);
c.ForeignKey(e => e.AccountId, (IEnumerable)ViewData["Account"], "AccountId", "Name").Title("Account");
c.Bound(e => e.PrimaryContact);
c.Bound(e => e.ReceivesNotifications);
c.Bound(e => e.FirstName);
c.Bound(e => e.LastName);
c.Bound(e => e.Department).Hidden();
c.Bound(e => e.Address1).Hidden();
c.Bound(e => e.Address2).Hidden();
c.Bound(e => e.City).Hidden();
c.ForeignKey(e => e.StateProvinceId, (IEnumerable)ViewData["StateProvinces"], "StateProvinceId", "StateAbbName").Title("State Province").Hidden();
c.Bound(e => e.Zip).Hidden();
c.ForeignKey(e => e.CountryRegionId, (IEnumerable)ViewData["CountryRegions"], "CountryRegionId", "CountryCode").Title("Country Region").Hidden();
c.Bound(e => e.Phone).Hidden();
c.Bound(e => e.PhoneExtension).Hidden();
c.Bound(e => e.Fax).Hidden();
c.Bound(e => e.Email).Hidden();
c.Command(command => { command.Edit(); command.Destroy(); }).Width(155);
})
.Events(events =>
{
events.Cancel("Helpers.HideNotificationArea");
})
.Sortable()
.Selectable()
.Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("EditContact"))
.Pageable()
.Filterable()
.ToolBar(items =>
{
items.Create().Text("Add New Contact");
})
.DataSource(d => d
.Ajax()
.ServerOperation(true)
.PageSize(15)
.Model(model =>
{
model.Id(m => m.ContactId);
model.Field(m => m.ContactId).Editable(false);
model.Field(m => m.AccountId).DefaultValue(-1);
model.Field(m => m.PrimaryContact).DefaultValue(false);
model.Field(m => m.ReceivesNotifications).DefaultValue(false);
model.Field(m => m.FirstName);
model.Field(m => m.LastName);
model.Field(m => m.Department);
model.Field(m => m.Address1);
model.Field(m => m.Address2);
model.Field(m => m.City);
model.Field(m => m.StateProvinceId).DefaultValue(-1);
model.Field(m => m.Zip);
model.Field(m => m.CountryRegionId).DefaultValue(-1);
model.Field(m => m.Phone);
model.Field(m => m.PhoneExtension);
model.Field(m => m.Fax);
model.Field(m => m.Email);
})
.Read(read => read.Action("Read_Contacts", Constants.ContactController))
.Create(create => create.Action("Create", Constants.ContactController))
.Update(update => update.Action("Update", Constants.ContactController))
.Destroy(destroy => destroy.Action("Delete", Constants.ContactController))
.Events(events =>
{
events.Error("function(e){Helpers.GridError(e, '" + Constants.ContactGridId + "')}");
events.Change(#<text>
function(e) {
Helpers.HideNotificationArea(e);
Helpers.OnChangeForeignKeyRead(e, ['AccountId'],['StateProvinceId'],['CountryRegionId']);
}
</text>);
})
)
)
You have to pass the values of your foreign key as ViewData and use the ViewData in your editor template.
#{
Html.Kendo().Grid(Model.Contacts)
.Editable(e => e.AdditionalViewData(new
{
Accounts = Model.Accounts
})
// ...
.Render();
}
So after doing some research, I found out the best way to customize the Kendo PopUp Editor is creating a custom editor template and place it on you ~Views/Shared/EditorTemplates folder. Once you provide the name of the template on you main grid cshtml like this:
.Editable(editable => editable.Mode(GridEditMode.PopUp)
.TemplateName("_EditContact")
Once I figured that out, there was another issue with the dropdownlist not showing the value from the table but it was populating ok. This took some time to figure out since there's not a lot of documentation on Kendo. The workaround for this was removing the .Name("ColumnName") property with
.HtmlAttributes(new { #ColumnNameId = "ColumnName" } )
Here's the full code for _EditContact.cshtml
#model Humana.Billings.Web.Models.ContactModel
#using Humana.Billings.Web.Helpers;
#using System.Collections;
<div class="editor-label">
#Html.LabelFor(model => model.ContactId)
</div>
<div class="editor-field">
#(Html.Kendo().TextBoxFor(model => model.ContactId)
.Enable(false)
)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.PrimaryContact)
</div>
<div class="editor-field">
#Html.CheckBoxFor(model => model.PrimaryContact)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.ReceivesNotifications)
</div>
<div class="editor-field">
#Html.CheckBoxFor(model => model.ReceivesNotifications)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.FirstName)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.FirstName)
#Html.ValidationMessageFor(model => model.FirstName)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.LastName)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.LastName)
#Html.ValidationMessageFor(model => model.LastName)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.Department)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.Department)
#Html.ValidationMessageFor(model => model.Department)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.Address1)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.Address1)
#Html.ValidationMessageFor(model => model.Address1)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.Address2)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.Address2)
#Html.ValidationMessageFor(model => model.Address2)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.City)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.City)
#Html.ValidationMessageFor(model => model.City)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.StateProvinceId)
</div>
<div class="editor-dropdown">
#(Html.Kendo().DropDownListFor(model => model.StateProvinceId)
//.Name("StateProvince")
.HtmlAttributes(new { #StateProvinceId = "StateProvince" })
.Filter("startswith")
.DataValueField("StateProvinceId")
.DataTextField("StateAbbName")
.BindTo((System.Collections.IEnumerable)ViewData["StateProvinces"])
)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.Zip)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.Zip)
#Html.ValidationMessageFor(model => model.Zip)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.CountryRegionId)
</div>
<div class="editor-dropdown">
#(Html.Kendo().DropDownListFor(model => model.CountryRegionId)
//.Name("CountryRegion")
.HtmlAttributes(new { #CountryRegionId = "CountryRegion" })
//.Filter("startswith")
.DataValueField("CountryRegionId")
.DataTextField("CountryCode")
//.AutoBind(true)
.BindTo((System.Collections.IEnumerable)ViewData["CountryRegions"])
//.ToClientTemplate()
)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.Phone)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.Phone)
#Html.ValidationMessageFor(model => model.Phone)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.PhoneExtension)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.PhoneExtension)
#Html.ValidationMessageFor(model => model.PhoneExtension)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.Fax)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.Fax)
#Html.ValidationMessageFor(model => model.Fax)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.Email)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.Email)
#Html.ValidationMessageFor(model => model.Email)
</div>

I get button at the top on asp.net mvc4 Page

I have a following code in View.
I suppose the button should come at the end of field set, but it is coming at the top as shown in the figure.
<fieldset>
<legend>tblCategory</legend>
#Html.HiddenFor(model => model.Id)
<div class="editor-label">
#Html.LabelFor(model => model.CategoryName)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.CategoryName)
#Html.ValidationMessageFor(model => model.CategoryName)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.Description)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.Description)
#Html.ValidationMessageFor(model => model.Description)
</div>
<input type="submit" value="Save" />
</fieldset>
put it in a <p>:
<p>
<input type="submit" value="Save" />
</p>

how to use submit button with ajax in asp.net

In my Asp mvc project I want to add company to database without refreshing the page.
How can I do it with ajax. I want to submit data and return to the same page without refresh.
this is a part of my code
#using (Html.BeginForm("Create", "Company", FormMethod.Post, new { enctype =
"multipart/form-data" }))
{
#Html.ValidationSummary(true)
<fieldset>
<div class="editor-label">
#Html.LabelFor(model => model.nom_company)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.nom_company)
#Html.ValidationMessageFor(model => model.nom_company)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.desc_company)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.desc_company)
#Html.ValidationMessageFor(model => model.desc_company)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.datedebut_company)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.datedebut_company)
#Html.ValidationMessageFor(model => model.datedebut_company)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.datefin_company)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.datefin_company)
#Html.ValidationMessageFor(model => model.datefin_company)
</div>
<p>
<input type="file" name="file" />
<input type="submit" value="Create" />
</p>
</fieldset>
}
Any help please

Html page doesn't post to a controller

I have class in a model Customer
When I am clicking a submit button on Cshtml page,
#using (Html.BeginForm())
{
#Html.ValidationSummary(true)
<fieldset>
<legend>Registration</legend>
<div class="editor-label">
#Html.LabelFor(model => model.Fname)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.Fname)
#Html.ValidationMessageFor(model => model.Fname)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.Lname)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.Lname)
#Html.ValidationMessageFor(model => model.Lname)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.Address)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.Address)
#Html.ValidationMessageFor(model => model.Address)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.phoneNo)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.phoneNo)
#Html.ValidationMessageFor(model => model.phoneNo)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.Username)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.Username)
#Html.ValidationMessageFor(model => model.Username)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.Password)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.Password)
#Html.ValidationMessageFor(model => model.Password)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.ConfirmPassword)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.ConfirmPassword)
#Html.ValidationMessageFor(model => model.ConfirmPassword)
</div>
<p>
<input type="submit" value="Create" />
</p>
</fieldset>
The page doesn't post to the controller
[HttpPost]
public ViewResult DisplayCustomer(FormCollection Collection)
{
objinfo.Fname = Request.Form["Fname"].ToString();
objinfo.Lname = Request.Form["Lname"].ToString();
objinfo.Address = Request.Form["Address"].ToString();
objinfo.phoneNo = Request.Form["PhoneNo"].ToString();
objinfo.Username = Request.Form["UserName"].ToString();
objinfo.Password = Request.Form["Password"].ToString();
objutility.InsertEmployee(objinfo);
return View("DisplayCustomer");
}
I am not able to get Values into request.form. What particular code I am missing?
1 - you don't need to use Request.Form, or FormCollection .
Your controller(s) should look like this:
// this method should just display the page, not handle the post back
public ViewResult DisplayCustomer(){
return View();
}
// this method will handle the post back
[HttpPost]
public ViewResult DisplayCustomer(Customer model){
// Handle the post back.
if(ModelState.IsValid){
/* Hanlde the submission, at this point "model" should have all the properties, such as model.Fname, model.Lname, etc...
DB.InserOnSubmit(model);
DB.Customers.AddObject(model);
DB.Customers.Add(model);
you get the point
*/
}
}

CKEditor MVC 3 implementation

Learning mvc and I am trying to implement a page with 3 fields Name-Surname-Description
So in my learning example I am loading employees and I should be able to create and edit them.
The description should use CKEditor .
I can load employees
I can save them
However I cannot seem to be able to save the description,such as whatever the user types in the description field. I have seen few examples on the net but none with a solution to download,as I cannot seem to put together. I have found this guy with a cool html helper but cannot seem to be able to put an example together
http://www.andrewbarber.com/post/CKEditor-Html-Helpers-ASPNET-MVC-Razor-Views.aspx
The problems are :
How do you get the value that is typed inside the ckEditor.
In my viewModel the description is null all the time
the ckEditor slow down the creation of the page quite a lot.How can I make it faster? I dont need all the options.
Is there an example using mvc3 out there that I can use as a template.
I have done all the plumbing as follows:
Create.chtml
#model MvcApplicationCKEditorIntegration.Models.EmployeeViewModel
#{
ViewBag.Title = "Create";
}
<h2>
Create</h2>
<script src="#Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="#Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
#using (Html.BeginForm())
{
#Html.ValidationSummary(true)
<fieldset>
<legend>EmployeeViewModel</legend>
<div class="editor-label">
#Html.LabelFor(model => model.FirstName)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.FirstName)
#Html.ValidationMessageFor(model => model.FirstName)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.LastName)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.LastName)
#Html.ValidationMessageFor(model => model.LastName)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.Email)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.Email)
#Html.ValidationMessageFor(model => model.Email)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.PhotoPath)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.PhotoPath)
#Html.ValidationMessageFor(model => model.PhotoPath)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.Description)
</div>
<div class="editor-field">
<textarea class="ckeditor" id="ckeditor" rows="10"></textarea>
</div>
<p>
<input type="submit" value="Create" />
</p>
</fieldset>
}
<div>
#Html.ActionLink("Back to List", "Index")
</div>
<script type="text/javascript" src="../../ckeditor/ckeditor.js"></script>
EmployeeController
public class EmployeeController : Controller
{
public ActionResult Index()
{
var employeeRepository=new EmployeeRepository();
var employees = employeeRepository.GetAll();
var employeeList = employees.Select(employee => new EmployeeViewModel
{
EmployeeId = employee.EmployeeId,
FirstName = employee.FirstName,
LastName = employee.LastName,
PhotoPath = employee.PhotoPath,
Email = employee.Email,
Description = employee.Description
}).ToList();
return View(employeeList);
}
public ActionResult Create()
{
return View(new EmployeeViewModel());
}
[HttpPost]
public ActionResult Create(EmployeeViewModel vm)
{
if(ModelState.IsValid)
{
var employeeRepository=new EmployeeRepository();
var emp=new Employee
{
FirstName = vm.FirstName,
LastName = vm.LastName,
Description = vm.Description,
Email = vm.Email,
PhotoPath = vm.PhotoPath
};
employeeRepository.Insert(emp);
return RedirectToAction("Index");
}
return View(vm);
}
}
}
Thanks for any suggestions!!!
EDITED EXAMPLE USING CKEditor helper
#using MvcApplicationCKEditorIntegration.Helpers
#model MvcApplicationCKEditorIntegration.Models.EmployeeViewModel
#{
ViewBag.Title = "Create";
}
<h2>
Create</h2>
<script src="#Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="#Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
#Html.CKEditorHeaderScripts()
#using (Html.BeginForm())
{
#Html.ValidationSummary(true)
<fieldset>
<legend>EmployeeViewModel</legend>
<div class="editor-label">
#Html.LabelFor(model => model.FirstName)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.FirstName)
#Html.ValidationMessageFor(model => model.FirstName)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.LastName)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.LastName)
#Html.ValidationMessageFor(model => model.LastName)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.Email)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.Email)
#Html.ValidationMessageFor(model => model.Email)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.PhotoPath)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.PhotoPath)
#Html.ValidationMessageFor(model => model.PhotoPath)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.Description)
</div>
#Html.CKEditorFor(model=>model.Description)
<p>
<input type="submit" value="Create" onclick="#Html.CKEditorSubmitButtonUpdateFunction()" />
</p>
</fieldset>
}
<div>
#Html.ActionLink("Back to List", "Index")
</div>
<script type="text/javascript" src="../../ckeditor/ckeditor.js"></script>
You aren't actually using the CKEditor helper at all like is described on that blog page (which is my own blog)
The purpose of that helper is that once you have included the code correctly into your project, you can simply do this:
#Html.CKEditorFor(model=>model.Description)
However, you seem to simply be creating a plain-old text area and working with it 'manually' after that. There isn't anything to bind it to your property, as would exist if you had used the helper described in that post.
Also note that you aren't using the code that Updates the text area behind the scenes; so if your model has Required set on the Description field, you will get a client-side validation error the first time you submit an otherwise properly-configured CKEditorFor() This isn't unique to my helper; any bound property that is 'required' needs the bit of Javascript that is mentioned in that blog post, too. I do it as an onclick off the submit button, but you can run that same code anywhere. You just need to include it in the page, which you haven't done.
You might want to try setting the name attribute of the textarea to "Description"
so:
<div class="editor-field">
<textarea class="ckeditor" id="ckeditor" rows="10" name="Description"></textarea>
</div>
if that doesn't work then you might have to use javascript to get the value of what's in the editor and set it in a hidden field before the post.

Resources