Frontpage IF Statements in Default value

  • Thread starter Thread starter Junior
  • Start date Start date
J

Junior

Hello All,

Although my syntax is SQL correct I am unable to place an IF statement
in the default value of a text box.

What i am looking at acheiving in having a conditional default value in
a text box entry field of my form.

The form is a database query with filter and search fields at the top
of the form with the results at the bottom of the form.
I wish the text box to default to a specific value dependant upon the
default value in another text entry box.

Everytime I do this I get an error at runtime to do with the IF
statement.

Can anyone help me ?
 
Show up your code.

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WebMaster Resources(tm)

FrontPage Resources, WebCircle, MS KB Quick Links, etc.
==============================================
If you feel your current issue is a results of installing
a Service Pack or security update, please contact
Microsoft Product Support Services:
http://support.microsoft.com
If the problem can be shown to have been caused by a
security update, then there is usually no charge for the call.
==============================================
 
correction:

Show us your code.

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WebMaster Resources(tm)

FrontPage Resources, WebCircle, MS KB Quick Links, etc.
==============================================
If you feel your current issue is a results of installing
a Service Pack or security update, please contact
Microsoft Product Support Services:
http://support.microsoft.com
If the problem can be shown to have been caused by a
security update, then there is usually no charge for the call.
==============================================
 
I have tried many multiple types of if statements, below is one I have
attempted.

I think I mentioned before it is an entry field window at the top of a
database results window. The entry field determines selection option in
the results whcih are returned to the same page.

Ideally I want the field (Titled Workperformed) to default to 0,
however if someone changes the value of the field and submits a query
on the page, I want the changed value to be the default so it still
displays on the form.

Firts time the page loads it should default to 0, after a query it
should default to what was in the query before the page reloaded on a
submit.

<%=If Server.HtmlEncode(Request("WorkPerformed"))<>0 then
Server.HtmlEncode(Request("WorkPerformed")) Else 0 End If%>

Again thanks you your help.
 
In the field value try

value="<%=If Server.HtmlEncode(Request("WorkPerformed"))<>0 Then %>
<%=Server.HtmlEncode(Request("WorkPerformed")) %>
<%Else %>0<%End If%>"

- presumes somewhere above the code you have defined
Request("WorkPerformed")

--




|I have tried many multiple types of if statements, below is one I have
| attempted.
|
| I think I mentioned before it is an entry field window at the top of a
| database results window. The entry field determines selection option in
| the results whcih are returned to the same page.
|
| Ideally I want the field (Titled Workperformed) to default to 0,
| however if someone changes the value of the field and submits a query
| on the page, I want the changed value to be the default so it still
| displays on the form.
|
| Firts time the page loads it should default to 0, after a query it
| should default to what was in the query before the page reloaded on a
| submit.
|
| <%=If Server.HtmlEncode(Request("WorkPerformed"))<>0 then
| Server.HtmlEncode(Request("WorkPerformed")) Else 0 End If%>
|
| Again thanks you your help.
|
 
That returns...

Error Type:
Microsoft VBScript compilation (0x800A03EA)
Syntax error
/wwwroot4/ABSsearch.asp, line 97, column 15
Response.Write(If Server.HtmlEncode(Request("RequestID"))<>0 Then)
--------------^
 
Why are you Encoding it and where is RequestID coming from, a form field, a querystring, etc.?

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WebMaster Resources(tm)

FrontPage Resources, WebCircle, MS KB Quick Links, etc.
==============================================
If you feel your current issue is a results of installing
a Service Pack or security update, please contact
Microsoft Product Support Services:
http://support.microsoft.com
If the problem can be shown to have been caused by a
security update, then there is usually no charge for the call.
==============================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top