"YOU AND THE ART OF ONLINE DATING" is the only product on the market that will take you step-by-step through the process of online dating, provide you with the resources to help ensure success. Get it now!
Your submit button is outside of the form tags. It won't know what form to submit.
Up vote 1 down vote favorite 1 share g+ share fb share tw.
I have the following dialog form : × Add Tags and his JS : When I click x, which is ×, the form close down leaving me on the current page, while I'd like to go on the hamepage. Also "Add tag" botton, which is don't do nothing, while clicking jaust ENTER on the keyboard do the job and I'd like clicking "Add tag" did the same. I'm not so skilled on JS and front-end prog, so any help is welcome.
Javascript jquery forms modal-dialog twitter-bootstrap link|improve this question edited Feb 20 at 18:48 asked Feb 19 at 12:29Luca G. Soave1,067214 97% accept rate.
Your submit button is outside of the form tags. It won't know what form to submit. Use javascript to connect it to the form.
Submit As for the × that is supposed to link to the homepage, why not just remove the data-dismiss='modal' and make it act like a normal link using a standard href='home. Html'. Here is some additional code to point you in the right direction for using AJAX to submit the form: // Since we want both pressing 'Enter' and clicking the button to work // We'll subscribe to the submit event, which is triggered by both $('#modal-form').
On('submit', function(){ //Serialize the form and post it to the server $. Post("/yourReceivingPage", $(this).serialize(), function(){ // When this executes, we know the form was submitted // To give some time for the animation, // let's add a delay of 200 ms before the redirect var delay = 200; setTimeout(function(){ window.location. Href = 'successUrl.
Html'; }, delay); // Hide the modal $("#my-modal"). Modal('hide'); }); // Stop the normal form submission return false; }).
Thanks TheShellfishMeme, x close works fine linking href='home. Html' like you said and Submit works from the function point of view but is not able to close down the form after clicked ... – Luca G. Soave Feb 19 at 13:48 Do you want to close the modal or go to home.
Html? – TheShellfishMeme Feb 19 at 14:21 when I click on "Submit button" as well as I just click on ENTER I'd like it close the modal (updating the input) and go to home. Html (while clicking on x just go to home.
Html and already works like you suggested before by doing : x) – Luca G. Soave Feb 19 at 14:26 You basically have two choices: Either you submit the form using AJAX and then change the page once it's done or you send a redirect from the server once the form has been submitted. I think you are looking for the first option.
Then you can submit the form, wait until that worked successfully, close the modal, wait until the animation is done and then redirect. – TheShellfishMeme Feb 19 at 14:54 thanks for your support TheShellfishMeme but modal form, still doesn't close down, neither after pressing 'Enter' nor after clicking the button. I need a method to debug this and see where it fails/stop/don't get evaluated ..., any idea?
– Luca G. Soave Feb 19 at 18:28.
The problem for submitting form lies within bootstrap own JS modal library (bootstrap-modal. Js) - basicaly submit event is being prevented due to line #204: ev. PreventDefault (why?
). My solution was to add: if(!$(e. Target).
Parents('form')) e.preventDefault(); however I don't know what problems it will spawn.
With HTML5 you can have something like this: × Add Tags This called in HTML5 form-associated element of-course if you need to support all browsers + old ones then you need to go with JavaScript, but you can use JavaScript as a fallback :).
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.