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

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Update value of one field dependent on the value of another.

Thread began 9/19/2014 1:09 pm by iainmacdonald331081 | Last modified 9/19/2014 2:22 pm by Jason Byrnes | 324 views | 5 replies |

iainmacdonald331081

Update value of one field dependent on the value of another.

Am just wondering if this sort of thing is possible....

I have a table which includes two fields:

Rank
Score

Rank can be 1, 2, 3, 4 or 5.

Score needs to be 10 (for a Rank of 1), 6 (for a Rank of 2), 3 (for a Rank of 3), 2(for a Rank of 4) or 1 (for a Rank of 5).

So basically if the Rank field is updated to 1, can it be set up so that the Score field updates to 10 etc?

Thanks.

Sign in to reply to this post

Jason ByrnesWebAssist

yes, this can be done but will take some hand coding.

create a the rank select list and a hidden element for the score, then add code at liune 1 to set the score value:

<?php
if(isset($_POST['rank']) && $_POST['rank'] != "") {
switch ($_POST['rank']) {
case "1":
$_POST['score'] = "10";
break;
case "2":
$_POST['score'] = "6";
break;
case "3":
$_POST['score'] = "3";
break;
case "4":
$_POST['score'] = "2";
break;
case "5":
$_POST['score'] = "1";
break;
}

}
?>



then in the update behavior, bind the rank column to the rank form element and the score column to the score form element.

Sign in to reply to this post

iainmacdonald331081

Thanks Jason - does it need to use select list, or should it work with a text field?

I currently have a text field in an update multiple records behavior.

Which I've tried, but doesn't look like its working. So just trying to figure out if I've gone wrong somewhere, or if its gone wrong because I'm not using a select list.

Sign in to reply to this post

Jason ByrnesWebAssist

ok, well, you didn't mention you where using a multiple update field, that is going to take far more complex code to accomplish, we can help you implement that in a premiere support appointment:
http://www.webassist.com/premier_request.php

Sign in to reply to this post

iainmacdonald331081

Thanks Jason - I just wanted to establish if it should work in principle. I'll get a few ducks in a row with this and then look into the premier support.

Sign in to reply to this post

Jason ByrnesWebAssist

yes, it should work with a text field instead of a select list.

with a multiple record insert / update form, the form elements are dynamic ly named with a unique identifier:
rank_0
rank_1
rank_2
rank_3
etc..

so the code needs to be modified to look for each rank / score combination, we can help set that up in a premiere support appointment.

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