I'm working on a website which shows images. Eeach image has just one description which can be edited or added by any user. Accordingly, there are 2 forms: one for adding and the second for inserting at the same page. I displayed the form which I need and hid what I don't by javascript.
My question is how can I prevent the user from leaving the specific form (not all page and the same URL)?
To be clearer, I will tell you the senario precisely
IF (There is no description)
showing adding button
else (there is a description)
showing the description found ih the DB as a paragraph and editing button
Once the user clicks the adding button, a form with a text area for adding will be shown. And the same goes with editing. I WANT TO PREVENT THE USER FROM LEAVING WHEN ONE OF THE FORMS IS SHOWN. Hopfully things are clearer now !
Thanks in Advance!!