close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

emptying / zeroing a column

Thread began 1/05/2019 6:51 am by Jamie | Last modified 1/08/2019 12:41 pm by Ray Borduin | 585 views | 7 replies |

Jamie

emptying / zeroing a column

Hey Ray

In the backend on the product_update page I have a drop down field (SpecialOffer) (yes/no) to toggle on / off an input field (SpecialOfferOldPrice) to add a value that gives a discount to that product

The problem I am having is that if I have set the drop down to Yes (1) and added a value, eg £5.00 if I then go back and set it to no (0) the input field SpecialOfferOldPrice retains the 5 discount - how do I go about emptying or adding 0 to SpecialOfferOldPrice when SpecialOffer is set to 0 (no)?

Page attached if needed

Cheers

Jamie

Sign in to reply to this post

Ray BorduinWebAssist

You can change the value to use when blank in the server behavior for each column. This one is set to "blank", but you can update it to use "zero". That field probably doesn't accept a blank value since it is numeric.

Sign in to reply to this post
Did this help? Tips are appreciated...

Jamie

I have tried that

$UpdateQuery->bindColumn("SpecialOfferOldPrice", "s", "".((isset($_POST["SpecialOfferOldPrice"]))?str_replace(array("£","%",),"",($_POST["SpecialOfferOldPrice"])):"")  ."", "WA_ZERO");


but that doesnt make that col 0 or blank. I guess the problem is that the column has a value in it from when the specialoffer was set , when you set the specialoffer to off, the SpecialOfferOldPrice still has a value in it and thats the value am trying to remove or zero

Sign in to reply to this post

Ray BorduinWebAssist

I see... then you just have to use the toggle in the value comparison like:

php:
$UpdateQuery->bindColumn("SpecialOfferOldPrice", "s", "".((isset($_POST["SpecialOffer"]))?str_replace(array("£","%",),"",($_POST["SpecialOfferOldPrice"])):"")  ."", "WA_ZERO");
Sign in to reply to this post
Did this help? Tips are appreciated...

Jamie

that isnt zeroing the column SpecialOfferOldPrice wehn SpecialOffer is toggled to 0 ('no')

Sign in to reply to this post

Ray BorduinWebAssist

Maybe try:

php:
$UpdateQuery->bindColumn("SpecialOfferOldPrice", "s", "".(isset($_POST["SpecialOffer"])?str_replace(array("£","%",),"",($_POST["SpecialOfferOldPrice"])):"0")  ."", "WA_ZERO");
Sign in to reply to this post
Did this help? Tips are appreciated...

Jamie

sorry, still not zeroing

Sign in to reply to this post

Ray BorduinWebAssist

I didn't realize you were using a select list and not a checkbox. In that case, since your "no" value in the select list has a value of zero the correct code would be:



php:
$UpdateQuery->bindColumn("SpecialOfferOldPrice", "s", "".($_POST["SpecialOffer"]?str_replace(array("£","%",),"",($_POST["SpecialOfferOldPrice"])):"0")  ."", "WA_ZERO");
Sign in to reply to this post
Did this help? Tips are appreciated...

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