Copied to clipboard

Flag this post as spam?

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


  • Jason Espin 368 posts 1335 karma points
    Nov 16, 2015 @ 10:52
    Jason Espin
    0

    Model values failing to be clear

    Hi all,

    I am creating a multi-stage booking process in Umbraco. As part of this I have a value in my model called stage. Depending on this value, my view will output a different set of fields in my form.

    Towards the end of the process, I have a form that collects credit card details. These details are sent to a payment provider immediately and then destroyed. At least this is what I want to happen but the model fails to clear correctly.

    enter image description here

    In my controller i do the following:

    if(bookingSuccess){
         // Move to the next stage of the booking process
    }else{
       TempData["notification"] = "There was an error processing your booking. You have not been charged.";
                            model.Stage = 2;
                            model.Passenger_Details.cc_Number = string.Empty;
    }
    
    return View(model);
    

    As you can see, if there is an error making the booking with the third party provider, I set the model stage back to where the card details were captured (stage 2) and then I attempt the reset the value stored in the model for the credit card number so that we force the user to re-enter these details. The CCV number is find because this is set as a password field and is does not get remembered anyway.

    My problem is, this does not work. If the booking fails, it successfully returns me to stage 2 of the booking process but the card details are still populated.

    What is the best way to remove these details and force the user to re-enter them?

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies