how can i contact us page to django - html

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.

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

Creating a data-entry Form with multitable Query

I have a form in my Access Database that is used for students to scan their badge and log in. If their badge hasn't been registered, the form just allows them to enter their information. I'm running into a problem where I'm using a Query that pulls their badge number from the previous form (which is inserted into a table temp) and compares it to the table with their information on it.
The problem I'm running into is that when I do this, I can't edit the information in the form, nor can I add more to entries, and when I separate the query and try to just pull from the table externally
(BadgeNumber = [temp]![T2])
it just pulls up a messagebox asking for the value.
Does anyone have any suggestions for accomplishing this?

Access Forms - Catch 22 trying to insert data to multiple related tables

I'm new to Access but have many years experience using "enterprise" databases. I'm having trouble implementing a simple task and suspect that my preconceptions are causing me to miss the point so I'm asking for some help.
The simple task is using Access forms for Data Entry that populates two tables: Customer and CustomerAddress (can be multiple addresses per customer).
The Customer table has primary key CustomerID. The CustomerAddress table has primary key CustomerAddressID and CustomerID as a foreign key with RI on that relationship.
Form1 is bound to the Customer table. After entering info for various fields, the user can click a button to display Form2 which is bound to CustomerAddress and enables data entry for multiple addresses.
Form1 passes the CustomerID (assigned by Access) to Form2. Form2 is not a subform due to size but it could be if that would solve the problem.
In a perfect world, I would want all the new data from both Form1 and Form2 to be committed together. Presumably I could do this using unbound forms and code the insert statements inside a single transaction.
Question 1: Is there a way to do this using bound forms?
If I use Form1 without ever clicking the "Address" button then a row is successfully added to the Customer table. The problem comes when trying to add CustomerAddress row(s) in Form2 before the Customer row has been added to the table.
In Form2, if the CustomerID is not used, then there is an insert error because a CustomerAddress row cannot be added without a CustomerID.
If the CustomerID is used, then there is an insert error because the CustomerID does not exist on the Customer table yet (although the ID appears to have been "reserved").
It's not practical to force the Customer row to be added before opening Form2 as some Customer required fields are not present at that point in the workflow.
Question 2: Is there a way round this? It seems like a common requirement.
I could work around this by removing the RI so that the CustomerAddress rows can be added first, but this seems poor DB design and I'd also need clean-up logic for the case where the Customer add is subsequently cancelled.
As mentioned, I'm probably missing the point and there's a better approach. Any help much appreciated.
I think you would have the same problem regardless of which RDBMS you used if you are enforcing referential integrity. The CustomerID needs to exist in the Customer table before a record can exist in the CustomerAddress table. I'm guessing that CustomerID is an autonumber. What is probably confusing is that Access does immediately 'reserve' an autonumber as soon as a new record is started. However, it does not exist in the Customer table. If that record is never saved, that autonumber value is lost and the next record would get the next number. Requiring an address to be completed before saving the Customer record, sounds like a design problem. It doesn't seem logical. Personally, I would re-think the design. That said, one solution would be to create a temp table for addresses and bind your CustomerAddress form to that. Then, when the customer record is saved, you would run an append query to add the new addresses to the CustomerAddress table. Remember, though, that if a user enters some addresses and the Customer record is never saved, all of that data entry is lost.
With regard to your statement:
It's not practical to force the Customer row to be added before opening Form2 as some Customer required fields are not present at that point in the workflow.
You are correct that you won't be able to insert the Customer row if the "required but not yet known" fields have their Required property set to Yes (i.e., NOT NULL). However, with Access 2010 and later you could use an event-driven data macro to make such fields "not required" on Insert but "required" on Update. In your case, you could
allow the Customer record to be inserted without the "eventually required" fields,
allow the addition of CustomerAddress records (with RI enabled), and then
re-open the Customer record for updating, with the data macro now enforcing the "required" status of the other fields.
The Before Change data macro might look something like this:
I think the answer lies within your Question 1. Yes there is a way to do this with bound forms, and would be the approach I would use.
Form1 is bound to the Customer table. Add Form 2 onto Form 1 as a subform. Select / highlight Form 2, goto the properties sheet. On the Data tab, set the Link Master Field to CustomerID and Link Child Fields to CustomerID.
Then after any action taken on Form 1, requery Form 2.
I think this will get you started and at least should give you an idea on how to proceed once completed.
I fail to see why both must be or one would even want to submit both customer and a record from the child table at the same time.
What about when you want to add an additional address, then that add address button and code now will have to check + test if the main customer already exists, and use separate logic to deal if the customer record exists, or does not. And what about if a user has entered the customer name and info, and does not yet have the address as the customer on the phone might have just moved and has to call back with the new address. I can think of another half dozen cases in which building a design in which both customer and customer address records MUST be added at the same time.
As others noted, you going to have this issue with any relational database, including Access. I should also point out that Access works EXACTLY the same here if you use Access as a front end to SQL server or Oracle.
So it makes little sense to build a different UI and coding process for adding the customer and the address, and then a DIFFERENT set of rules and UI for adding additional address over time. So build a form to search + find a customer, and add that customer and display that customer. Once that process is done, then you add the process (and UI part) to allow the user to view, or add address to that customer. I don’t think I ever seen a UI with separate forms to add/edit customer and a separate form to allow additional address to have some requirement that they are submitted together at the same time.
If the user bails out of the Address because they realize the address is not available, wrong etc., this should not suggest that the customer information entered so far be dumped and not added. If the user after bailing from adding the address (say close or cancel that form), then you return to the customer form. If the user decides at that point in time for some strange reason they do NOT want the customer in the system anymore, then provide a delete button.
If the business rules are that one MUST ALWAYS have at least one address in all cases, then upon closing the customer form you don’t allow the form to be closed and request that that user enter at least one address for this user. And perhaps they bumped or hit the wrong key to exit the address enter part – no need to penalize that user and force them to re-enter the customer info. So don’t let them exit the customer form until they enter an address or provide them (suggest to the user) they can delete/remove the customer fi they want to exit.
If you use a form + sub form setup, then zero code is required for the relational part. And a tab control gets you both forms can be near full screen size. (no need to launch a separate form).
Of course you could write a bunch of code and placed everything in a transaction, but such is a waste of coding time for no benefits and amounts to theft of company hours and time when not required.

Merge two fields before posting to 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.

How to improve security of an online form that do not require a login?

I have an online form that is sent to our suppliers by our contract department. This form allows our suppliers to update their company information and product prices.
We do not want to force them to use a login since we don't want to create an account for all our suppliers, and this is something that they will do once a year, so they will most likely forget their credentials.
This online form does display some sensitive information since it will display the current "broker" price.
I was thinking of creating a unique URL that will be sent to them through email. But I have to make sure that
Only the intended recipient is able to read and update the form
Reduce the risk of URL forgery that would allow someone to open a bunch of form by guessing the other unique URL.
This URL will be sent by email and we expect the supplier to click and edit the form. In the email, I was gonna include a numeric password that must be used when posting the updated information and each URL would have an expiration.
What are the best practice in generating such unique URL and what step could be used to increase the security to prevent the risk listed above?
generate a random string for each customer like GJAOEJGOMASDIG2351DSFGSD and put that somewhere in the URL. When they access the URL - make sure the random string matches the company's random string...?
http://www.domain.com/form.php?customerId=255&rand=GJAOEJGOMASDIG2351DSFGSD
$sql = "Select * from customers where id=".$custId." and randomHash='".$randString."'";
This way, viewers need to know the customer's ID and their matching random string. If either do not match, deny access.
make sure to take precautions against SQL Injection.
The most obvious answer is:
Add to the URL a parameter with a random number, large number (store in a DB which numbers have been assigned, and to which email)
When the user clicks the URL, he must put the right email in the form.