Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • k 256 posts 654 karma points
    Apr 16, 2015 @ 15:32
    k
    0

    Forms - issue

    Hello,

    I am using Forms on my umbraco 7.2.1 . On submitting the form it clears the fields.

    Ex : I have 2 mandatory fields, Firstname and email.

    When I fill the firstname field with the correct value but email is empty, and I click on submit button, the page reloads and clears the firstname field containing the correct values.

    Can some one please advise on how to correct the javascript (which file to acceess) or any other solution.

    Thanking you in advance for your help,

    kusum

     

     

     

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Apr 16, 2015 @ 19:41
    Dennis Aaen
    0

    Hi kusum,

    To me it sounds like you maybe missed to include the jquery.validate plugin to your frontend, so it validate if a field is required. Try to see this documentation on how to repping frontend using Umbraco Forms.

    https://our.umbraco.org/documentation/Products/UmbracoForms/Developer/Prepping-Frontend/

    Hope this helps,

    /Dennis

     

  • Justin 19 posts 163 karma points
    Apr 19, 2015 @ 02:34
    Justin
    0

    Hi Kusum,

    i agree with Dennis. I would add that if your form is posting to a controller (server side validation), you must check ModelState and if you have an error make sure you pass the model back to your view:

    [HttpPost]
    ActionResult myAction(myModel formModel)
    {
    
    if (ModelState.IsValid)
    {
        //great, do stuff
    }
    else
    {
        //do something with the model state errors...
    
        return View(formModel);
    }
    
    }
    
  • k 256 posts 654 karma points
    Apr 23, 2015 @ 13:38
    k
    0

    thnks dennis it worked :)

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Apr 23, 2015 @ 14:00
    Dennis Aaen
    0

    Hi kusum,

    Great it works :-).

    I think that you should mak the post as solved, so other can see what works for you and jump straight to the solution. Ff you donĀ“t know how to mark a post as solved I will explain it to you.

    You have a green tick in the left side of the screen next to the avatar picture. You can mark the question as solved by tick the green tick, for the post that gives you the right answer to your problem. You can only choose one post as the solution.

    /Dennis

Please Sign in or register to post replies

Write your reply to:

Draft