Merge two fields before posting to MySQL - mysql

Any help and/or direction you can give me will be greatly appreciated.
My site has drupal 7 installed and a bunch of plug-ins. I am using a third party web hosting site.
On my website, I have a webform that submits a several member info. When this information is submitted, it gets submitted into, what appears to me, as a default form submission data table on mysql. I guess I have a two part question.
First, I would like my webform to be submitted in a custom table so that webform, contacts and etc have their own database table.
Secondly, I would like to merge two columns together to form a unique user email on my site. For instance, in my webform, the first field is a 'State' dropdown list where the user has to choose the state they are in. And the second field, they have to type in a user specific info. So when they choose the state and fill in their unique user info, I would like to combine these two columns to create an email address, e.g. unique_user_info#fl.mysite.com.
oh, btw, I put the values in state dropdown to add state-specific info. in other words, if the member chooses 'Florida' then it adds, #fl.mysite.com and chooses 'California', it adds #ca.mysite.com
Once again, your help on this will be greatly appreciated.

With the Webform Rules and Rules modules (may require Tokens module), you may be able to concatenate the two field values for storage in your email field when the form is sumbitted.
Or, you might write a jQuery function to handle concatenation and fill of a hidden email field on the clientside.

Related

how to assigne correct client_ID to order record from name, adress or create a new one if it doesn't exist

I am trying to build a simple ms Access database.
For the sake of convenience, I will translate into sales, orders and such.
Orders
OrderID - PK (auto number)
Client ID - FK to clientID in the Clients table
Clients
ClientID - PK (auto number)
LastName
FirstName
Company
Address
...
I created a form (main form) that allow the user to specify details for a new order, including the client details.
The same form is used to look the details of older orders, to change their step for instance.
When the clerks types in, I don't know if the client is already registered. After everything has been completed, the clerk saves the new order as a new record in the Orders table.
However, Access complains rightly that the clientID FK has not been set: we set the clients name, first name... but not the ID.
My ultimate goal is that, at the saving of the new record, a request that look up into the Clients table to identify a list of possible candidates that match the client first and last name and open a form (contact form) that nicely displays the data from the first record of the request and allow the clerk to navigate between the records, and eventually select one or select create new record with the data from the main form.
I figured that a good place to do this would be in the save button on my form.
I tried to add something in the event code (macro) with something like (not VBA, a pseudo code I've never seen in the other office applications):
if IsNull([main form]![clientID]) then
bip
launch a request to identify the clients in the clients table with the same first and last name
open a form to look into each selected record and select the correct one or if none is identical generate a new one and return the clientID
end if
executeMenuCommand
command saveRecord
The code I tried above didn't even bipped...
I have placed the bip first, and that didn't bipped either.
I receive a message (explicit) that ms Access could not find a record in the client table with the specified clientID.
So I guess my main question is how do I test if there is a clientID associated with the current record?
The next problem is to come back to the main form with the selected clientID.
From what I have seen in the templates provided by Microsoft, it is avoided by defining a single field for customer in their main form. This field is a list populated from the client table, and if you stray away from the list you get a new form for editing a new client.
This is not the behaviour I am looking into. I need to have the posibility to free text enter every field and chose at the saving moment to create or not a new customer.
I hope I am clear enough, please feel free to ask for more details.
edit: thanks to Gustav's hint, I figured that the event was not to be associated with a button click but on the form itself. It helped me uncover other underlying problems... so I guess my problem is not ripe anymore for soliciting external help.
In VBA, use IsNull, and Me if the form is bound to table Orders:
If IsNull(Me![clientID].Value) Then

how can i contact us page to django

Save all the contact us inputs on the database, and create a view to handle all the
records. Tasks include
Search and sort: based on the user entries like the services, or the
email, phone number, names etc.
Delete: records with irrelevant information to be
removed/fake/false records to be removed
Insert:: new records to be inserted when a new entry is submitted
how to perform these tasks
You should create a model and define the fields in question here. You can use the django admin panel to organize the records, it gives sorting and searching by default. You can detect fake records by sending an e-mail to the entered e-mail address. I have no idea how you can do this with a phone number.

How to save row values from one field in subform to main form record? - Access

I have a parent form (frmGroupSession) that has a subform (SubFormParticipants) in datasheet view. The subform is based off a query that selects all participants ([CLIENT ID], [NAME], [ATTENDED]) that had attended a specific group [GroupID] on a specific date [GroupSessionDate]. The parent form saves to a table that logs group sessions (tblGroupSessionLog). I need to save the group's participants [CLIENT ID] to the record within tblGroupSessionLog
Basically, I need to pass data from the subform to the record within tblGroupSessionLog. I'm not sure what the most effective way to do this, if it's possible at all. Ideally, I would like to have each unique participant [CLIENT ID] stored in its own field within tblGroupSessionLog. If there were 20 participants in the subform then each row value from the first column/field [CLIENT ID] would be passed to the corresponding field within tblGroupSessionLog ([ClientID1] thru [ClientID20])
I am relatively new at this. Even asking the question was difficult.
I am not sure what else I can provide to help you wizards with the solve, but let me know and I will.
Thoughts? Ideas?
Access 101 : You have a many to many relationship You should look that term up but in short it means clients can belong to many groups and each group can have many clients. (so bang your data into a normalized structure similar to the following:
First tip make sure to add the relationships under database tools (you should look that up). Access needs to know how the tables are related to manage the keys behind the scenes and sometimes access makes better decisions about automatic form creating when it already knows the relationship structure. Once your data is properly structured access makes it easy to produce functional if much less than styling data entry forms which can also be used as even worse search forms. For instance Click on any table and hit create form on the ribbon and access will create the data entry form form you.
Basic Style tip 1: Always delete primary key fields like ClientID from the form. The field is still there in the form's record source being managed by access. Users almost never need to see any table keys. This gives you a basic data entry form which you can also use to scroll through any clients you have entered using the record selector circled at the bottom of the frmClients.
Play around with the record selector to see how it works. In particular go past the last record and you will find you can enter new clients and access will automatically give them a ClientID. You can also cycle through your Clients and update them using this form it just isn't stylish. In the same way we can make a form for the groups table.
You make a form for the frmGroupSessions table in the same manner as the others but add a step. Replace the text boxes holding ClientID and GroupID with human readable comboboxes. Here is a link to help with that: https://www.google.com/search?q=access+change+text+box+to+combo+box&oq=access+change+text+&aqs=chrome.0.0i457j0l2j69i57j0j0i22i30l2.7503j0j1&sourceid=chrome&ie=UTF-8#kpvalbx=_r0sFYJ7vBcfY5gLz2aTgBw15
Becomes:
At this point play around to learn. Use the Record Selector at the bottom of frmGroupSessions to add and modify data. Play with the Tables and see what happens. Start messing with the form properties in particular the default view. Soon you will have ideas about how the form could be better and you can start figuring out how to style them.

How do I auto-fill fields in Access from a linked table?

I have two tables in an Access (2007-2010) database which are linked. I have created forms with a command button in my 'Organisation' form that opens up a new record in my 'Contacts' forms. I would like to automatically fill in some of the fields in the 'Contacts' form from the 'Organisation' form, such as the 'OrganisationName' field, which will be the same information in both forms. Is there a way I can do this? I have spent many hours searching online and have tried various things, but have not found an answer yet! Thanks in advance for any help.
You can get the behavior you're looking for by setting the Default Value property of the text box on the Contacts form to the control on the Organisation form:
[Forms]![Organisation]![OrganisationName]
This will copy the value from one form to the other.
If you are storing the same values, like OrganisationName, in both your Organisation and Contacts tables, your table structure probably needs some normalisation. You could, for example, have an OrganisationID stored in your Contacts table, and look up all of the relevant Organisation information for display on the Contact form. Somewhere on your Contact form you will have a field, probably a ComboBox, bound to the OrganisationID and that ComboBox's Default Value could be set to the OrganisationID on the Organisation form, which would give you the same result without duplicating the OrganisationName itself in both tables.

Many-To-Many MS Access Form With Checkboxes for All Options

I'm working on a Microsoft Access application for a summer camp to track which entities have signed up for which activities. There is a form for editing an entity's information. I would like to add to that form a list of all activity options. By each option should be a checkbox. When the checkbox by an option is checked, a entry should exist in the many-to-many junction table linking the entity with the activity.
Google offered some examples of building many-to-many forms but none (at least that I found) showing how to provide a full list of options with checkboxes.
How would I do this?
Database Table Layout:
Entity (EntityID, first name, last name, etc.)
Activity (ActivityID, activity name)
Entity_Activity (EntityID, ActivityID)
One way to do this:
Create a new entry in the Activity
table.
Manually insert one checkbox
per activity on the form.
Register
an onClick handler on each checkbox
that adds the appropriate row to the
junction table when tje checkbox is
checked and removes the appropriate
row when the checkbox is deselected.
I was hoping for an approach that didn't require manually laying out the form. With this method, every time a new activity is added, the form must be modified. Oh well....
Instead of check-boxes, the more natural way to do it with MS Access would be to have a list of activities (in a sub form) that each entity is signed up for. Activities would get added from a pull down list (and perhaps an Add button), and removed with a Remove button. With a clever query, you limit that list to only activities that the entity doesn't have yet.
Alternately, you could go with the checkboxes, but you'll have to modify your table layout slightly. Entity_Activity would need a third field (SignedUp, yes/no). You would then have to populate every Entity_Activity combination when you created a new Entity. However, if you should happen to add another Activity later on, you'll have to go through some hoops to get all the existing Entity's entries updated.