Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I'm using PHP framework Symfony 3, i have a simple form where the user can create a Sponsor object, when he submits that form i want a dialog (like confirm(..) with JavaScript) that is called after $em->flush() inside the controller that asks the user if he wants to create another Sponsor object, if he selects YES the form fields will be empty for him to create another, if he selects NO then he will be redirected to another page
How can i show a confirm() dialog before or after submitting the form so i can decide where to redirect the user ?
Symfony is a PHP Framework. So no you cannot do that with PHP.
One solution would be to add an hidden checkbox. When the submit button is hit, you can do a confirm() in JS and checked (or not) the checkbox. According the state of this checkbox you redirect your user to one page or another.
An other solution would be to add a visible checkbox and let the user decide when he fill the form.
An other solution would be to send the form async with JavaScript, so you can ask to your user whether or not he want to create a new Sponsor.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I was just wondering how do I make my website preview some info after the user searches for something stored in the database.
Basic approach for previewing user names as you type in a search bar. For this to work, you will need to use AJAX to query the server and also display the result as a preview for the user to click on if they want, without having to refresh the page.
User types 'Joe' into the search bar
The onChange() even is fired and you query your server with that the user has written "Joe". Keep in mind this query is via AJAX, so as not to force the page to reload.
Server side, you do a MySQL lookup of the table users, where the name is something like "Joe". SELECT NAME FROM USERS WHERE NAME LIKE '%what_you_sent_on_AJAX_request%' LIMIT 10;
The browser receives the response from the AJAX request and displays a nice dropdown with the output of the server. When the user actually click son this "previews" it is in that moment that you would actually reload to the page or take the user to a new page based on what they have clicked on.
That's a very basic approach for it.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I'm currently creating a website with a list of members on a page.
Members will register via a form, and once the form is filled in, I would like a card component to be created on another page (which will be password protected and only usable by an admin) with the choice to either accept the members request (of which their name will be automatically added to the members page) or decline the request, in which case the card will be deleted.
Can anyone suggest how I might go about automatically creating a card including information via the form?
Thanks in advance.
Your question is very general.
The easiest way is to use php to control the data of your form and with mysql PDO to insert them into a database.
Then in the database add a column for each registered "status", that when it is at 1, you post it as a confirmed member. If it is at 0 it must be confirmed.
I hope I've helped you
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I have a requirement where, Users inputs something and submit then angular does a service call which returns if users input is valid/invalid. If valid take user to success page, if service returns invalid/bad input then user needs to be taken to failure page and should never be able to go back(using back button) or user refresh the page, user should still be on same page. Only option provided to the user should be close browser, there by not allowing using to submit one more request(leading to service call).
You cannot prevent the user from not running or editing client-side JavaScript code. Since this is a security requirement against the interest of that particular user, the solution must be server-side:
On the server, after getting the wrong answer, mark the user's profile as such. You may need an additional table in your database joining users and questions for that.
Whenever the user loads the question or submits it, first check the user's flag. If it's set, error out immediately.
Note that this behavior is quite hostile to the user. For instance, the user may accidentally touch Enter too soon, and will be shut out by your system.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I currently have a form which lets the user input 4 fields. What i'd like to know is if it possible to fill and submit a form on a totally separate website with the data that the user previously submitted using the form. If so, how can i do it?
It's possible with direct HTTP post or get requests if the form doesn't have a security mechanism like CSRF tokens. Browsers won't allow users to do that with AJAX if the target website doesn't allow it (Target website is supposed to set a specific header to indicate whether the cross domain requests via AJAX is allowed).
If you want to submit it as soon as the user submits it, just recreate the form with html anywhere you want with the fields. The target url should be the absolute URL.
If you want to submit it later, You can save the submission data in a database and use "cURL" to submit it later with PHP. (more details here)
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
When user clicks 'add new' button I want to add more textbox into the page, so that he can add n number of values. I will do this with jQuery. But on submit click I want to get values from all the fields at server side. How can I accomplish this?
You can store values in hidden field which has runat="server" using javascript and use that hidden field in server side code of asp.net
Use jQuery.clone() to make a clone of the inputbox.
Remember this inputbox will be in array form as below
<input name="clonedbox[]"
and then just send it in submit function or ajax call.