Link to home
Start Free TrialLog in
Avatar of Aleks
AleksFlag for United States of America

asked on

ASP/VB Syntax

I have the code below which is giving me a syntax error, should be simple ... I hope.

           <% ' If field is checked off
If (Qnrpg1.Fields.Item("email").Value = "False")Then
input name="email" type="hidden" id="email" value="(ContactDetails.Fields.Item("Email").Value)"
<% End If %>  

It should check for the value of a field, if its "False" then should create that hidden field. This is the error:
Avatar of Big Monty
Big Monty
Flag of United States of America image

is email a string value or a boolean? if it's a boolean value, then you would want:

 <% ' If field is checked off
If (Qnrpg1.Fields.Item("email").Value = False )Then %>
input name="email" type="hidden" id="email" value="(ContactDetails.Fields.Item("Email").Value)"
<% End If %>  

Open in new window


if it's a string value, then you have it correct, you're just missing your closing %> tag:

 <% ' If field is checked off
If (Qnrpg1.Fields.Item("email").Value = "False")Then %>
input name="email" type="hidden" id="email" value="(ContactDetails.Fields.Item("Email").Value)"
<% End If %>  

Open in new window

if this isn't working, please post the error as it was absent from your first post
ASKER CERTIFIED SOLUTION
Avatar of Gary
Gary
Flag of Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Aleks

ASKER

The first two solutions gave me an error still, the third one worked fine. Ill try that one thanks !