This topic is locked

untick checkbox

1/3/2008 9:33:50 AM
ASPRunnerPro General questions
N
NigelEtienne author

I am trying to automatically "untick" a checkbox when a user edits a page forcing the data to be resubmitted. I have created the following EditOnLoad event:
Sub EditOnLoad()

strupdate = "update tblLeaveRequests set LeaveApproved='0' where " & where

dbConnection.Execute strupdate

End Sub
When I try and edit the page I get the following error:

Technical information**Error number-2147217900Error description[color=#cc3300][Microsoft][ODBC Microsoft Access Driver] Syntax error in WHERE clause.URL/gfc_leave/output/tblLeaveRequests_edit.aspSQL query**select [LeaveID], [EmployeeID], [MyName], [MyEmailAddress], [LeaveType], [LeaveStart], [LeaveEnd], [HalfDay], [AdditionalInfo], [LeaveApproved], [LeaveRejected], [LeaveApprovedBy], [EmailAddress], [LeaveApprovedDate] From [tblLeaveRequests] where ([LeaveID]=1256) and ([EmployeeID]=252631) [/color]

The Access database field is a yes/no format, so I assume that 0 = No or unticked.
Any help gratefully received!

J
Jane 1/9/2008

Hi,
there is no where variable in the EditOnLoad event.

I recommend you to use Edit page: Before display event for this purpose.

Here is a sample:

smarty("value_FieldName") = 0



where FieldName is your actual field name.

N
NigelEtienne author 1/10/2008

Hi,

there is no where variable in the EditOnLoad event.

I recommend you to use Edit page: Before display event for this purpose.

Here is a sample:
where FieldName is your actual field name.


Now works, many thanks for the solution.

U
uludag 1/14/2008

Hi,

I have the same problem. However, I could not understand where I put the code. Would you mind explaining it in detail.

Where is "Edit page: Before display"

Where I am to put the code "smarty("value_FieldName") = 0"

Thanks in advance.

Sergey Kornilov admin 1/15/2008

Proceed to the Events tab in ASPRunnerPro to find "Edit page: Before display" event.

U
uludag 1/30/2008

Hi,

I put the code above, and it works fine except one problem.

Now, every record seems unchecked in edit page. For example, admin, co-admin or editor of my database edits a record and thicked the check box. When you look the record, it appears ok, I mean, checked. However, when someone reedits the same record, it automatically unthick the check box.

What I want is that if the check box is thicked, it remains so; if it is unchecked, it remains unchecked.

What am I suppose to do?

Sincerely,

Uludag.

J
Jane 1/30/2008

Hi,
just remove this code in the event.

That's all.

U
uludag 1/30/2008

I tried it, Jane.

But this time, whenever I edit a record, the checkbox automatically appears thicked, and this is not what I want. It must be there just as it is. If it is thicked, thicked. If not, unthicked.

P
Philip 1/31/2008

Hi,

  1. is it possible that you have set somewhere a default value (either in your Access DB or in ASPRunner) ?
  2. I would check the DB as well (does the field realy contain just 0 or 1 ?)
    Philip

U
uludag 2/8/2008

Hi,

Could there be a code like that:

If borrowerID -1 or empty, then 0 in Onloan, otherwise -1 (in Onloan).


And if there could be a code, where should I put it?
Maybe, this can be done even on my database (MS Access). But I do not know how?
Sincerely,
Uludag.

J
Jane 2/13/2008

Hi,
you can publish your project on Demo Account and send to support@xlinesoft.com a URL to your pages along with instructions on reproducing this error.

I'll find what's wrong with your project inspecting it at Demo account site.