I have an app that has to send bulk email to selected users. I need to display my users table with a checkbox per row and a submit button with a form handler to operate on checked rows. Considering the built-in features of GC like the filter and column sorting, pagination, etc... I thought using GC would be a good solution. I found info on adding the checkbox. How do I add a submit button and form handler? Anyone have a hint or two where to start?
There are several ways to do this. I will explain two ways here.
Create the checkbox, for the id value use some unique data of the user details such as userid or username. After that on change of check box selection call a javascript method to update the hidden field with the current status. You can use some special delimiter to separate the check boxes. Let say if check box with id 1,5,6 are checked then the hidden field should be updated to "1#5#6". In the server side you can use the explode method to make an array and then you will have the usernames in array.
Another way is using AJAX and processing it immediately. I have used this way on my Codeigniter Code Generator at http://www.thephpcode.com to update the user roles' permissions. An admin user can grant or revoke permissions to a user role. All the permissions will be displayed with check box and with current status. When changed it will be updated immediatly through AJAX call.
Related
What I want to do
I'm trying to build a form in Symfony 2.8 that requests the user's choice between many types of credentials and add an input box to the form it's similar to this one but I use a select option field instead of buttons.
What I did
I was able to create this form with HTML and JavaScript.The user can select more than one credential type only once except the OTV Option that can be selected without limits.
image here
What's my problem
I need a way to store user's data in a session and get them in my controller.
Is it possible to pass submitted data from HTML form to a Symfony controller and if not how can I build a similar form with Symfony's formBuilder ?
CollectionType is probably what you are looking for.
For your purposes, you can think of it as adding rows to the end of a two-column list. The Left Column has credential_type with Name, Email etc in a <select>; and the Right Column allows for your text values.
You'll have two FormTypes: one for the list, and another for the list item. In the list item FormType, you should be able to set a CallbackConstraint to validate e.g. that email values are valid upon form submission.
All user changes are saved at the same time, only when the form as valid.
I think you can do that. There is CollectionType in Symfony form. You can read about it here and how to implement it here
P.S. The main problem in this case is to generate specific names for dynamically created fields to provide a normal handling data in controller.
I'm using chronoforms 5, made a form for creating a record. It works all fine.
But my problem is I need a form for edit the record. I've no idea how to load & show the record data. Anyone has ideas?
You have to be able to identify the record you want to edit. Usually this is by the Record ID, the User ID, or possibly the User email if that is unique. Then you can make a copy of your entry form, rename it, and add a DB Read action at the top of the On Load event in the Setup tab - if you are using the Simple Wizard then you have to switch the form to Advanced mode in the General tab to do this.
Edit the DB Read action to link to the table and set the Conditions box to load the record you want to edit - there is a FAQ about doing that.
You should be using ChronoConnection to list the records. The user selects a record which then displays the form to edit it.
First of all, let me explain the scenario:
I have a GridView in template and it works fine. Now imagine that a user did the following actions:
He applied some filters on data
He also sorted by some columns
What I want to do - is to save value of his actions, i.e save values of sorting columns and values of filters when he clicks on "edit -> save" and returns back.
It's something similar to flash, but for attributes. Is this even possible to do with Yii2's built-in tools?
Well, after assigning the parameters to your search model and before you return the data provider you could simply store the search model in the session and then load it again when the user returns to the grid view.
In one application I even use this method to store the filters in the user settings rather than the session so they persist between sessions, ie. after user logs out and back in again.
I have a registration form on my website and I want certain fields to be pre-filled when a user returns. for example first name, last name, job function etc but other fields to be left blank that are unique to the particular registration process.
what options do I have to do this for example user log in, "remember me"....etc ?
Also what are the pros and cons of these possible options(breifley)
any help would be great
I don't understand your question totally but maybe this will help:
a.) Store the pre register data in a database. Then when the user returns, just select the pre filled data from the db and then just display it as you like.
b.) Use $_SESSION in PHP.
[as I said, I don't know what you want to do...]
store the form data in the database and maybe compare user id with table id of the form table.
and something like that:
<input value="LOAD_DB_FIELD">
I have a form-1 which has 4 fields. when the user inputs data in these and hits submit, he is taken to form 2 for further selection of more items from multiple selection box. after selections are complete, he is prompted to update and on updating, all the data has to go to a third form for processing.
currently i am passing the single fields data from second form to third form by <input type="hidden" name="abc" value="<?php echo $x[0] ?>">
I am getting stuck as to how to retreive all multiple selected items from the array, perform a calculation on them and then post to mysql and then update the user with posted information.
or is there a better way of doing this, pl. guide me. my fields are:-
first page
customer id - single selection field
date - input
segment selection - single selection field
second page
items inputs - itemid, quantity,price (these are in one row and user will dynamically add or delete rows based on requirements. i have done this through Javascript)
now after all this, i want to gather all details of customer, segment, items(id,quantities,prices) and then post them to mysql.
If you want to use separate pages you can use either hidden inputs fields or sessions to pass along their selections. With sessions, you'd just store the array of data in $_SESSION and use session_start() on each page to get the session from the previous page. With hidden inputs, you can store them just like you would with session, and when they click POST you will rewrite them into the form. Are you stuck on specific aspect of doing this?
On the final page use either the session or the hidden fields (depending on your chosen method) + the final POST, to query MySQL.
Note: As Zirak mentioned in the comments, you could also do this using a single page. You'd use one of the same methods described above, except it would post to itself rather than to another page. This might be a faster/better way to code the page... If you opt for the single page method just ensure that you make it possible to go back, both through their browsers back button and a link you provide.