Pressing enter in textarea field refresh the page - php

I'm using Symfony2 but i'm experiencing a troubling thing.
I have a form, with a textarea field, but each time i press 'enter' to go to the next line it refresh the page (without deleting the previous line)..
Do you have any idea where does it come from?
Thanks!

Well for sure you have a submit button on the form. On enter in a form you call the submit butt that refreshes the page!
In order to prevent that you can just make the button in the type="button" and bind a onclick function so that the submit button is not called on enter!
However; you will remove the enter feature that calls the submit on the entire form not just in the text area!
OR --> you can just call a function on keypres or keyup on the text area and e.prevetnDefault();
I hope my answers helps you!

Related

Force Bootstrap Form Validation Before Submit?

I'm working on editing an existing PHP form that seems to use Bootstrap to do the field validation (telling me if a required field is missing).
Currently, when you fill out the form and click Submit, a modal pop-up comes up that basically just prints your form data so you can review it before submitting. Then, within that modal is another Submit button that actually submits the form.
However, the validation of determining whether all the required fields are filled out only happens on the 2nd Submit button, not the first.
Is there a way I can tell my 1st Submit button to do the validation, and only open the modal pop-up if the validation passes?
Hello you can use Jquery. You can check with jquery first form values. If you need check with php you can use Ajax.

Reload page right before submit a form

I have a webpage that contains a form, and i need to refresh the page right before the form is submitted. Is there a way to have the Submit button refresh the current page and then submit the form to the proper php document?
I am using a general form with the submit button looking like
<input name="Submit" value="Submit" type="submit" />
Fix the page - do not pursue making this problem larger than it already is. I think it's some tunnel vision, you've made some mistakes on how you have setup your form or page, and now you are trying to continue down the wrong path instead of correcting your original problem.
Refreshing the page to submit some javascript data and then submit the form etc... is incorrect and needs to be fixed.
Best of luck and happy coding!
You can give the form a target to submit it in a new window and bind an event handler to it that refreshes the page on submit.
Please clarify what exactly you're trying to achieve. If you're trying to get some data from the server that's required to submit the form, it's possible to do (though it's not the best way to handle it). You'll need to intercept form submit, stop the events, perform an AJAX request to the server and then submit the form from code.

jQuery Modal Dialog

I wonder whether someone could help me please.
I've been working on, and I've managed to put together this jQuery Modal Dialog box and it works fine.
What I'm now trying to do is to link this page to the dialog box via a button click, to be specific the 'Upload Image(s)' button.
On the button click, the dialog box correctly appears on screen, but rather than it hovering over the main page which it's called from, it appears on a seperate web browser page.
I've been working on this for days now and I just can't seem to get around the problem. I don't think the problem is with the dialog box code, but most likely in how I call the opening of it. i.e. having two submit buttons on the main form, means that I have called the page as shown below
because I wasn't sure how to deal with both of the 'submit' buttons for this particular scenario.
<form name="savemyfindstolocation" id="savemyfindstolocation" method="post" action="testdialog.php">
I just wondered whether someone could perhaps take a look at this please and let me know where I've gone wrong.
Many thanks and kind regards
You're going absolutely wrong mate. You have created a form with the action as testdialog.php which is the dialog form, if I'm not wrong.
You've given the button Upload Image as type="submit", which would SUBMIT the form ofcourse, as it is doing now.
To open a dialog, you will require to use either an input button with type="button" or a link/anchor with an onClick event.
Can you please tell where is your dialog located and how are you working with the dialog?

I made a register form for my site but when I run it and you press enter on the last box(the email box) it doesnt submit the info

So I am making a site on dreamweaver and I cant figure out on my register page how to make it so when you press enter on the last box you need to fill in (email box) that it will automatically submit the info... instead it just deletes the stuff in that box... The only way to submit it is by actually pressing the submit button... anybody know how to do this? Thanks alot
Sounds like a tab order issue to me, make sure the submit is in the tab order right after the last input box. Also, you could do as the other suggested and use javascript to fire submit form event when the enter button is pressed.

Submit form twice or refresh two times

Hi I am using php and i want to submit form on onclick event of radio button.
when form submission is done, than after I want to reload my page.
Means first form is submitted and after form submit I want to reload my page again.
Is it possible?
I have tried it with javascript but not get any idea how to do it..
Thanks in advance.
header('Location: http://url.to/reload');
exit;
Make sure to do this before any output on that page otherwise you'll get an error about headers already having been sent.

Categories