Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You are at the wrong end of your execution sorry, the Controller is independent of the View i.e. you can't reply to the response during execution of the Controller code other than to return a View. You could do one of at least four things (I am sure there are other solutions):</p> <p>1 - Use Ajax to make a call to a JsonResult controller method that determines whether the entry already exists after the submit button is clicked - then based no the result of the query you can display a popup whereby "Yes" submits the form and overwrites, or "No" stops the form being submitted.</p> <p>2 - You can return the view (without submitting the query to the db) and ask the user to confirm overwriting the existing record - but you would have to add some additional logic like a hidden input field in order to determine that the user has seen the message and has agreed to overwrite. This wouldn't be a great approach and probably wouldn't be very intuitive for the user.</p> <p>3 - Add an "overwrite existing record" checkbox to the form that confirms that the user want's to overwrite the data if it already exists.</p> <p>4 - Logically seperate Add and Edit for the user so that when a user wants to update an existing record they select the record from a list and edit the existing data - this would be the most traditional method I would think. Then if the user attempts to add a new item that is the same as an existing one you simply re-display the page with an error stating that the record already exists.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload