Jump to content

Recommended Posts

Hi All,

i have a form with around 20 to 30 fields, some of these fields are file upload (file uploads are done as name in DB and file in folder and not as BASE64 or blob. i need to achieve following;

1 : let users submit part of form and comeback to fill rest (users will have login & pwd to come back)
2: know what fields are complete and which ones arent so show them incomplete only to fill

if there are any tools / form builders which can help achieve these.

thanks for your advise
 

Link to comment
https://forums.phpfreaks.com/topic/314690-ideas-form-with-loads-of-fields/
Share on other sites

If you are putting this input into a table you could add a key field to connect it to some token that is related to the page that shows the form.  User does some entry, submits it, you grab it and if it is incomplete you save the data and your key values and create a cookie to hold those key values so that when your form is called up again the cookie that your script looks at tells it where to get the provided data and places it on the form.  Once the input is complete you can delete the cookie and remove the key values from the db record.

If the data is not going to a table then you will have to make a table to hold it temporarily.

the form definition (each field's - id, label, type, name, placeholder text, choices/options, required attribute, validation attributes, ...) needs to be stored in a data structure (database table or array) and to allow for multiple different forms, the data structure should hold multiple definitions, each one receiving a unique id (auto-increment primary index.)

the logged in user would then select which form definition to fill in, or if only one definition, be presented with that form.

to save each field's entered/selected/checked value, you would need to use ajax to submit the data to the server.

the storage of the data on the server would be similar to a database based shopping cart/ordering system, where you would have a table holding the unique/one-time information about the instances of a form being filled out with - an id, the user_id, the form_id (from the defining structure), datetime, status, ... this establishes a form_instance_id. you would use this id to store the submitted form field data in a second table with - an id, form_instance_id, form_field_id, value, ...

when the visitor returns to the site and logs in, you would query the data to find if there are any form(s) in progress (the status column would be a value other than the one that corresponds to 'complete'.) you would give the user the choice of picking from among the incomplete form(s) or starting a new instance of a form. if they pick an incomplete form, you would query for the existing data values to re-populate the fields with. when you output the form, you would set the focus to the field after the last submitted value, i.e. the next form_field_id after that in the last row in the table holding the submitted data.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.