close ad
Help us test the new Databridge BETA with MySQLi support
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Insert/update from same page

Thread began 12/05/2012 8:16 am by aladdin229745 | Last modified 12/05/2012 5:39 pm by aladdin229745 | 580 views | 6 replies |

aladdin229745

Insert/update from same page

On one particular page I would like user to enter data then if they come back they can see all the full and empty fields and update if they want to. DataAssist creates 2 pages to be able to do this. Insert.php and update.php. I would like to be able to use just one of them so the user can insert and update from the same page. I think this can be done with a little code editing but I cannot work it out. If someone achieved this in the past please can you share your ideas.

Many thanks

Aladdin

Sign in to reply to this post

Jason ByrnesWebAssist

if you take a look at the update page, there is a recordset that is filtered using a URL variable, this recordset is used to populate the form with the values to be updated.

to be able to insert and update on the same page, you will need to have 2 buttons for the form. In the insert behavior, set the trigger to Button insert pressed. in the update behavior, set the trigger to button Update pressed.

be aware, though, that using the form for double duty like can cause confusion. The user may go to update a record and click the Insert button instead causing the updates to be lost for the original record, and stored as a new record instead.

From a user perspective, it may not be a great idea to make a page that can do both, just because it can be done, does not mean it should.

Sign in to reply to this post

aladdin229745

Thanks Jason,
Yes, I have considered several ways to do this and could not find a solution. Ideally we need to have just one button. So when the user comes to the page first time, all the fields are empty. Then they may enter some data and comeback to it another time to add more data. I am stuggling to work out the first part - when the form is visited first time. I need to be able to register the data in the tables. After the first time the update page function should work perfect.

I have manage to sort this out in Powermessanger when I was building the extra pages for the users by making a copy of a page and jugling the code round (maybe 24 hours later). But this one, I am really stuck.

If you can come up with a solution (one button for all) please let me know. Thanks

Sign in to reply to this post

Jason ByrnesWebAssist

can really be done with only one button without considerable custom coding.

Sign in to reply to this post

aladdin229745

I buy you a beer if you let me know the secret fomula. Better than pulling my hair :-)

Sign in to reply to this post

Jason ByrnesWebAssist

there really isnt a secret formula, just a lot of if statements to check that the form is empty on initial load, if it is, perform the insert, if the form is populated by the recordset, do the update.

Sign in to reply to this post

aladdin229745

I have tried to use 'if, else' statements yesterday. I think I was close but I couldn't get it working. I will study and learn a little more about it tonight.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...