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

send email if field value is "000000000"?

Thread began 9/07/2016 5:22 am by tony | Last modified 11/17/2016 5:45 pm by Ray Borduin | 761 views | 6 replies |

tony

send email if field value is "000000000"?

Hi all,
I have a form on a page where the user enter a value in a field.
I this field contains a specific string (0000000000) it will receive a specific email.
If this field contains anything else it will receive another email.
I already created an universal email behaviour on the form and it will send an email on submitting the form.
How can I do this with WA?
TIA

tony

Sign in to reply to this post

tony

ok,
I can do something working using the "show region" behaviour.
It seems to work, but there is still a little problem.

Basically I created 2 "universal email" behaviour.

I wrapped the first "universal email" behaviour with a "show region" behaviour that show the region if a specific form field IS EQUAL to a specific string.
I wrapped the second "universal email" behaviour with a "show region" behaviour that show the region if a specific form field IS NOT EQUAL to specific string.

It seems to work.

The specific string is "0000000000" (10 zeros).

So, the first "show region" behaviour is:

<?php
if ("".((isset($_POST["seriale_reg"]))?$_POST["seriale_reg"]:"") ."" == "0000000000") { // WebAssist Show If
?>

While the second one is:

<?php
if ("".((isset($_POST["seriale_reg"]))?$_POST["seriale_reg"]:"") ."" != "0000000000") { // WebAssist Show If
?>

The strange thing is that if insert "0000000000000000000" (more than 10 zeros) the first condition is met and it sends the wrong email. It seems that "0000000000000000000" is considered equal to "0000000000", But is is not.

If I insert a completely different value (for example: "848484848484848") it works as expected.

How can I fix this?
TIA

Sign in to reply to this post

Ray BorduinWebAssist

Use === instead of == and !== instead of !=

The issue is that it is evaluating the string as a number and "00" is the same as "00000"... using the new syntax it will use a more strict comparison of the values.

Sign in to reply to this post

tony

Originally Said By: Ray Borduin
  Use === instead of == and !== instead of !=

The issue is that it is evaluating the string as a number and "00" is the same as "00000"... using the new syntax it will use a more strict comparison of the values.  


Thanks for your reply.
Now it works.
But I loose the ability to edit the seerver behaviour.
This isn't a big headache, but the server behaviour should be updated to include such options, in my opinion.

Thanks again.

tony

Sign in to reply to this post

Ray BorduinWebAssist

Yes. I'll make sure it gets added.

Sign in to reply to this post

tony

Hi Ray,
I reopen this thread because I'm not sure it works as expected.
Is this the best method to check a form field before submitting and send a different email based on the form field entered value?

Or is there a better and safe WA method for this kind of operations?

What would be your best approach?

TIA

tony

Sign in to reply to this post

Ray BorduinWebAssist

I'm not sure if one method is better than another. I'm not exactly sure what you are doing on the site or what isn't working as expected, so it is hard for me to offer advice on an alternative technique.

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