I'm having issues with getting a form to submit while using route hijacking. I've gotten the form to render but nothing happens when I click Submit. I've read through the documentation and tried several different set ups but nothing seems to work.
I've tried having it setup within a controller inheriting from RenderMvcControl and with a controller inheriting from SurfaceController and using a Surface controller called from a partial view and all give me the same result.
Here is my code as it is now
Model
public class SubmitIssueModel : RenderModel
{
public SubmitIssueModel() : this(new UmbracoHelper(UmbracoContext.Current).TypedContent(UmbracoContext.Current.PageId)) { }
public SubmitIssueModel(IPublishedContent content) : base(content) { }
public string Company_id { get; set; }
public decimal CaseId { get; set; }
public decimal Issue { get; set; }
public string Department { get; set; }
public string IssueStatus { get; set; }
public DateTime IssueOpen { get; set; }
public string IssueState { get; set; }
[Required]
[DisplayName("Summary")]
public string Description { get; set; }
[Required]
[DisplayName("Description")]
public string CaseText { get; set; }
public string Priority { get; set; }
public string Openby { get; set; }
public DateTime Closedate { get; set; }
public string Version { get; set; }
public string Impact { get; set; }
public string Agent { get; set; }
public string Product { get; set; }
}
public class SubmitIssuesController : RenderMvcController
{
public ActionResult SubmitIssues() {
return View(new SubmitIssueModel());
}
}
public class CreateIssueSurfaceController : SurfaceController {
[HttpPost]
public ActionResult SubmitForm(SubmitIssueModel model){
TempData.Add("Success", "This is a test");
return RedirectToCurrentUmbracoPage();
}
}
It's not submitting at all. I can't get anything to happen when clicking submit. I tried adding some code to the template to trigger if IsPost but that's not doing anything either so it's not posting back to itself either.
It's funny how you always miss the little things. I noticed that out front end mockups weren't even submitting forms so upon looking at the code a little closer I realized that our submit button wasn't a submit button but a button that said submit. As soon as I switched it to type="submit" it started submitting, now i can get my logic worked out.
Form Submit not working with Route Hijacking
I'm having issues with getting a form to submit while using route hijacking. I've gotten the form to render but nothing happens when I click Submit. I've read through the documentation and tried several different set ups but nothing seems to work.
I've tried having it setup within a controller inheriting from
RenderMvcControl
and with a controller inheriting fromSurfaceController
and using a Surface controller called from a partial view and all give me the same result.Here is my code as it is now
Model
View (SubmitIssues.cshtml)
Controller
Any help would really be appreciated.
Thanks,
Owen
Hello,
Just a thought but have you tried beginumbracoform?
@model CommentViewModel
@using(Html.BeginUmbracoForm("CreateComment", "BlogPostSurface")) { }
Thanks for the response James.
I have tried BeginUmbracoForm and it gets me the same result, which is no result.
Just to add a little more information, I just noticed that the code above generates the following as the beginning form tag:
Does the page submit and redirect but with no update to temp data ?
It's not submitting at all. I can't get anything to happen when clicking submit. I tried adding some code to the template to trigger if IsPost but that's not doing anything either so it's not posting back to itself either.
It's funny how you always miss the little things. I noticed that out front end mockups weren't even submitting forms so upon looking at the code a little closer I realized that our submit button wasn't a submit button but a button that said submit. As soon as I switched it to type="submit" it started submitting, now i can get my logic worked out.
is working on a reply...