Jump to content

Complex Form


jandante@telenet.be

Recommended Posts

Hi,

 

I'm constructing a rather complex form (in my opinion ;)) to make it easy for a user to change his opening hours.

 

The project I'm working on is a simple page with the opening hours of all the shops in our city. But it must be able for the shopkeeper to change his openinghours.

 

To see it live: go to www.vinta.be => click on "Aanmelden" top right:

login: testing

pass: test

 

then go to "Mijn Bedrijf" also top right, and next click on Openingsuren.

 

You can see a table with openinghours. This is not working at all, it just displays the info from the database.

 

What I would like to do now is check every time the user changes something in the table (he checks a checkbox/changes time) if the changes are correct made and if so it should directly back to the database and the form should reload.

 

Do I need Ajax for that and if so where should I start?

 

[attachment deleted by admin]

Link to comment
Share on other sites

If you want to update the form everyime a user changes something in the form, you can do this easiily with a submit form function in an onchange parameter on each input tag. This however could either a- get annoying having to wait for every single change to be checked and saved into the db.

 

I would let them make all the changes they need, them have them tell the form "right, im done, save it please". This way, they make all the changes they need, and then they submit, php checks to make sure it all makes sense and if so saves it into the db.

 

you can use ajax for this as well if you dont want to reload the 'whole' page, but this method is much easier and quicker using php to santize the variables etc, rather than relying on javascript/ajax code to make sure everything makes sense etc.

 

hope this makes sense :P.

 

PS: Basically all u need to do is keepo this form how it is, make a "Save Changes" button, rather than having a type='submit', have a type="button" with a onclick="ajax_function()";

 

then ajax_function() would be an "ajax function" that would handle sending the form the php and php giving information as it is saved or rejected (sanitized).

-- Not really that much code

Link to comment
Share on other sites

The hard part for me is that the form should update after one clicks for example the Open checkbox.

 

If that is clicked the rest of that line should become active.

 

I suppose I will have to choose between this interactive mode written above or just let everything open to change and check for errors at the end.

 

usability tells me the interactive mode is the best, but can i make the form reload after something is changed in the form

Link to comment
Share on other sites

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.