close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Update Record Form Blank - After Data Assist / CSS Form Builder / Re-Binding

Thread began 3/18/2010 5:42 pm by dlovas275157 | Last modified 3/29/2010 9:24 pm by Eric Mittman | 1388 views | 8 replies |

dlovas275157

Update Record Form Blank - After Data Assist / CSS Form Builder / Re-Binding

My update.php form does not work correctly.

When I select a record to update on my results.php page, it is supposed to pass the url var to the update.php page and allow me to update the record. However, it does not appear to pass the url var properly as the update.php form is empty/blank when it comes up. Or the update page is not reading the passed url variable properly.

I followed these steps in creating my update form:
1. Created form with DataAssist Wizard (form works at this point!)
2. Applied CSS Form Builder to the update form
3. Re-Binded the Update Record Server Behavior to the values generated by the CSS From Builder

Could someone please advise me where I am going wrong. I do not have this issue with my insert pages, only my update pages.

Attached is my update.php form

Thanks for any help.

D.

--Update--

It appears that the "update link" on the results page is passing the url var properly to the update page, it is just NOT binding properly on the update page.

Is there a trick to re-binding the update form to the data after running the form through CSS Form Builder? I do not have this problem with any "insert forms". On my insert form, I re-bind after CSS Form Builder and they work fine.

Attached Files
hb_inventory_Update.php.zip
Sign in to reply to this post

Eric Mittman

On your update page the query is looking for a URL parameter named id_inventory. It seems that the query is setup correctly to work with this parameter. The problem that I can see on your update page is that you do not have any of the values from your recordset bound as the values for the form elements. For example your title form element, you have the value like this:

php:
value="<?php echo((isset($_GET["invalid"])?ValidatedField("hbinventoryUpdate","title"):"")); ?>"



It is set to show the value that you entered if the validations fail, but it is not setup to show you the default value for that record in the db. You will need to add in your recordset binding in here where the empty double quotes are like this:

php:
value="<?php echo((isset($_GET["invalid"])?ValidatedField("hbinventoryUpdate","title"):$row_WADAhb_inventory['title'])); ?>"



This should get the elements to show the value from the recordset when the page loads.

Sign in to reply to this post

dlovas275157

Eric,

Thanks for your reply. That appears to fix it for the textfields. I also adapted the solution to fix the list/menu as well. Checkbox is still giving me issues.

Is there a reason this is happening? Shouldn't this be filled in correctly after I run the CSS Form Builder and then edit the Update Record SB by re-binding the form elements to the proper values in the CSSFB generated recordset?

Is it a bug in DataAssist/CSSFormBuilder? Is there something I can do to prevent this while I build all my forms? Below is my process:

1. Create insert/update/results/search/detail/delete pages using DataAssist Wizard.
2. Apply CSS Form Builder to Insert and Update Forms.
3. Rebind Insert and Update Forms to data values produced by CSS Form Builder.

Thanks again for all your help.
D.

Sign in to reply to this post

dlovas275157

One more issue....

Eric - your fixed allowed the textfields to retain the values on the update form when the update form loads, BUT if you change the record via the update form and hit submit, none of the newer values get entered into the database. Record stays as it was originally.

Is this the correct procedure:

1. Use DataAssist to generate forms (insert/update/results...etc)
2. Apply CSS Form Builder to the Update Form
3. Re-Bind form elements to the new recordset generated by CSSFB.

This does not seem to work for update forms. Only for Insert Forms.

Sign in to reply to this post

Eric Mittman

You do have the correct steps, but for an update page you will need to do one more thing. The forms that are built by DataAssist by default are defaulted to show the current value for a particular column, the information comes from the recordset on the page.

You can either just bind the recordset value to it's corresponding form element, or you can manually update the code to add in the binding from the recordset. If you bind the value through the bindings interface you will loose the value that is there by default from CSS Form Builder.

By default form builder sets the value of the form elements to the validated text in case there is an error on the form this will retain the values that were entered by the user. I think in your case though you would probably prefer to have the default values from the recordset show if there are any error when submitting the form.

Your update page is not updating the record correct? Can you confirm that the update server behavior is being triggered? It looks like the trigger is set to any form post, you should try updating this to be submit button pressed. If you still have trouble with it after updating the trigger you should print out the query by adding a new line just after what is currently on line 73. In this new line add this code:

die($WA_Sql);

This should force the update query to be printed to the screen and let you know what is going on with it. If you do not get the query to be printed then it indicates that the update is not being triggered. Please post back with your result.

Sign in to reply to this post

dlovas275157

Eric,

Quickly, I added the die() code where you indicated and it generated the following:

UPDATE `hb_inventory` SET `id_inventory` = NULL, `title` = 'aaaaa', `authorFirstName` = 'aaaaa', `authorLastName` = 'aaaaa', `category` = 'Hunting & Fishing', `description` = 'aaaaa', `price` = 454564, `imgFile` = 'catpopsicle.jpg', `featured` = 'Y', `itemWeight` = 20 WHERE `id_inventory` IS NULL

great script btw,

Clearly the update SB is triggered, but not all necessary database columns are being set - the id_inventory is NULL which is my primary key. I have my id_inventory primary key column form element set to hidden when the form was created in DataAssist Wizard, and I have a feeling that could be part of the problem.

I already reset the trigger to "button: pressed" as you noted, but the problem persists.

I am going to start from scratch so I have clean code and completely rebuild the form with all your advice/tips. I will post back later today or early tommorow with my results/findings.

Sign in to reply to this post

Eric Mittman

On this update page you should not be specifying the id column to have a value, it should only be referenced on step one where you specify the index field and the value for it. You do not need to set a value for this in the update itself.

Looking at the query that you have it seems that you do not have a default value for the WADAUpdateRecordID field in your form. You need to select this form element and bind the id from your recordset.

Sign in to reply to this post

dlovas275157

Eric,

Sorry its taken so long for me to reply.

Basically my problem was that I missed assigning the default value to the hidden WADAUpdateRecordID right before the submit button.

Thanks for your assistance. Appreciated.
D.

Sign in to reply to this post

Eric Mittman

Glad to hear that, let us know if you have any other questions.

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...