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

Way to insert and edit

Thread began 4/11/2012 5:33 pm by h150477 | Last modified 5/07/2012 9:46 am by h150477 | 1270 views | 11 replies |

h150477

Way to insert and edit

I have an insert record form which has quite a lot of validation and hide / show fields on it.
It works as expected. I also need to provide an update record form for the same data. Is it practical to use a copy of this form to show the existing data in the record and apply an update record server behavior to it without having to enter all the validations again.
The problem as I see it is that I usually bind the date from the record that I am updating to the form fields during edit, when using a different validation system to security assist.
However, the fields need to be bound to the Webassist validation variables so that if a field does not validate, the data is re-displayed.

It seems that the same fields will need to be bound to two different variables which looks like it may not work.
So just how does one create an update record form and validate it?

Sign in to reply to this post

Jason ByrnesWebAssist

see this thread for details;
showthread.php?t=1146

Sign in to reply to this post

h150477

Originally Said By: Jason Byrnes
  see this thread for details;
showthread.php?t=1146  



That does not answer my question, or if it does then I do not understand what it is saying.

First of all, what is meant by

"Pass a url parameter in your failed redirect for your server validations like: pagename?valid=false"

In my insert page, there is no redirect anywhere other than to itself on failure or on success to a page that displays the data, so why would I need one in an edit page?

I am using existing data to fill out my form initially from a stored recordset, a typical field opening value being :"<?php echo $row_eventset['club_organiser']; ?>" This comes from the field being bound to the recordset value, in this case 'club_organiser'.
Following the other thread, which states:

<?php echo(isset($_GET['valid'])?ValidatedField("page","field"):"yourdefault"); ?>

How do I translate this for my field value?
I can see that "yourdefault" could be "$row_eventset['club_organiser']"

What goes in ($_GET['valid'])?ValidatedField("page","field")?

Where does "page" come into the argument? Does this refer to a page that the form re-directs to after a successful update. If the form redirects to itself, is this required?

All in all, it makes little sense, and these server behaviours are supposed to be for beginners like me to use.
Can you give additional information?

Sign in to reply to this post

Jason ByrnesWebAssist

you say:

  However, the fields need to be bound to the Webassist validation variables so that if a field does not validate, the data is re-displayed.  




the WebAssist validation variables you refer to come from the Server Validation Server Behavior.

In the Server Behaviors panel, you should have a server behavior named Server Validation

  First of all, what is meant by

"Pass a url parameter in your failed redirect for your server validations like: pagename?valid=false"  



In the server validation server behavior, there is a setting for Failed redirect. set this to redirect to the same page, and pass a query string variable, so if the name of the page is:
updatePage.php

set the failed redirect to:

updatePage.php?valid=false

  <?php echo(isset($_GET['valid'])?ValidatedField("page","field"):"yourdefault"); ?>

How do I translate this for my field value?
I can see that "yourdefault" could be "$row_eventset['club_organiser']"  



this would be:

php:
<?php echo(isset($_GET['valid'])?ValidatedField("page","field"):$row_eventset['club_organiser']); ?>




the validated entries code for your page will be generated from the bindings panel.

Go to the bindings panel, and expand the validated entries collection, then add a validated entries binding to your page, this will show the correct validated entries code for your page as a starting point.

If you are unsure of how to modify that code for the desired result, post it hear and i will be happy to help.

Sign in to reply to this post

h150477

Is this what you mean

Thanks Jason, but I still don't follow at all. When I make the changes suggested that all I get is a lot of uncorrectable syntax errors.
It looks to me like the only way to buid an edit page is to rewrite it all from the start, get it working and then add the validations.
Will do that and come back again if I'm stuck.

Sign in to reply to this post

h150477

I now have a working update page with all the formatting requirements for each field shown on the page.
If you can edit two of the fields to show how the information stored in them can be retained, I should be able to follow and do the rest myself.
One field is the event expiry, chosen because its a drop down list - does one need to validate these?
The other is the event title - just to show the idea.
The file is uploaded.

Attached Files
event_edit.txt
Sign in to reply to this post

Jason ByrnesWebAssist

you don't have any validation applied, so you only need to bind the fields to the corresponding column from the recordset.


for the title, select it in design view, in the property inspector, click the lightning bolt next to the initial value and select the title column from the eventset recordset.


for the select list, select it in design view, click the Dynamic button in the property inspector. Next to the Select Value Equal to option, click the lightning bolt and select the event date column from the eventset recordset.

Sign in to reply to this post

h150477

Its a long time since I used design view for anything.

Both fields are already bound to their recordsets as you describe in the submitted file, and any attempt to do what you state produces an error message that confirms this.

Can I re-frame the questions Jason, as I did not express myself correctly.

I do need validation, but have not done so yet.

1. Can you insert the required validations for the title as shown next to it in the file and display the resultant code, together with the bindings required to retain its value after a failed validation.

2. Do list menus need validating as they always have a default value which should be correct. I usually never validate these drop down lists as mine always extract their values from an existing validated recordset.

Sign in to reply to this post

Jason ByrnesWebAssist

1) You need to add the validation behavior.

I can show you the code for using either the recordset value or validated entries value after you have applied the validation behavior.


2) if you are sure the values wont change, then no you dont need to validate the select lists.

Sign in to reply to this post

h150477

I added some validation to all the fields, though one in particular does seem to have an error. Thiis is the event_description field, which will not accept the following text:

Europes Biggest LT meeting.<br>
See the event link for more information.
Limited accomodation remaining so book early or camp

which I thought that it should.

However, the file is attached as a text file.
Hope that this is enough.

Attached Files
updateeventcopy.txt
Sign in to reply to this post
loading

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