Suntower
Posts: 225
|
| Posted: 02/17/2005, 10:33 AM |
|
...And I don't cry easily, pal. But my frustration has begun to know no bounds. Sorry but I know this will be somewhat wordy.
This is essentially the same question I posted in http://forums.yessoftware.com/posts.php?post_id=56572 I'll try saying it a different way in the hope that this is simply a serious failure to communicate.
I have a Main Menu page, with a top menu that users select functions to go to. Fine, all that stuff works great.
BUT, I need a listbox on the page which FORCES the user to select a value from a table -before- they can proceed. So I use the Toolbox to create a form with a Listbox and the Listbox gets the table info and works fine. I then figure I need to add some code to either:
1. The embed point where the Selection has been made (server side)
or...
2. The 'Submit' button so that when the user presses the button -something- will happen. (The 'something' being some code to assign some global variables.)
BUT when I try to put anything in the 'Submit' button properties (Server or Client) or the server side 'After Execute Select' it NEVER 'fires' even though the button appears to 'click' on screen.
I have tried using the Client Side ( Confirm() ) function. I have tried a Server Side response.write and neither will 'fire'.
Why? Whyt? Why?
OK, better question: what do I need to do to troubleshoot this? There must be some fundamental idea going on that I just don't 'get'.
Frankly, I wish this thing allowed uploads---I am guessing that someone who knows this better could look @ the HTML and ASP and suss it out in 5 seconds.
HELP!!!!!! (Sorry.... but this has been going on far too long!)
---JC
_________________
---On a campaign for more examples and better docs! |
 |
 |
Alcides Soares
|
| Posted: 02/17/2005, 12:46 PM |
|
Suntower:
Iam a new user of CCS. But, if I understood your problem, there is a conceptual issue.
If you MUST have any variable defined BEFORE the submit goes on, you MUST define that the form variable is REQUIRED (in the Data Control Pannel). It does not matter if the value is in an control box or in a text text label, for example.
Since you MUST get a value for the control variable in the form, any further use of this variable will be "considered". If you do not define the control as REQUIRED, the program assumes that a value IS NOT NECESSARY... Any calculation using this control variable will not give results.
Try this single tip.
|
|
|
 |
Suntower
Posts: 225
|
| Posted: 02/17/2005, 1:33 PM |
|
Hello. Thanks for writing.
I have tried it with and without the Required attribute. The other odd thing is that sometimes the 'Add' button is visible and sometimes 'Submit' button is visible. Does this help explain? ALL I WANT IS A FLIPPIN' PICKLIST fer cryin' out loud!!!!
(Sorry. I just don't know how much more of this I can take. If I'd handcoded in HTML I'd be home and dry days ago. Literally.)
I agree there is a concept problem, but I was hoping to not have to examine the ASP and HTML line by line to suss it out.
---JC
Quote Alcides Soares:
Suntower:
Iam a new user of CCS. But, if I understood your problem, there is a conceptual issue.
If you MUST have any variable defined BEFORE the submit goes on, you MUST define that the form variable is REQUIRED (in the Data Control Pannel). It does not matter if the value is in an control box or in a text text label, for example.
Since you MUST get a value for the control variable in the form, any further use of this variable will be "considered". If you do not define the control as REQUIRED, the program assumes that a value IS NOT NECESSARY... Any calculation using this control variable will not give results.
Try this single tip.
_________________
---On a campaign for more examples and better docs! |
 |
 |
Benjamin Krajmalnik
|
| Posted: 02/17/2005, 2:07 PM |
|
If the parameters sent to the form result in a recordset being returned then
the "add" button will not be visible. If no recordset is returned then the
"add" button becomes visible.
Have you placed the redirect code in there as I suggested to see if the
event code is firing?
Can you post the code which you have on the On_Click server side embed?
|
|
|
 |
Suntower
Posts: 225
|
| Posted: 02/17/2005, 2:54 PM |
|
Yes, I have tried setting the redirect property and nothing happens.
Function NewRecord1_Button_Update_OnClick() 'NewRecord1_Button_Update_OnClick @35-8B1F9986
'Print Text @37-7D79C1CC
Response.Write "Hi There"
'End Print Text
End Function 'Close NewRecord1_Button_Update_OnClick @35-54C34B28
If I understand the concept, this indicates to me that the form is not being submitted...but how do I determine -why-? What is it that the form dislikes that it won't accept the 'submit' from the button? Or have I got this all backwards?
---JC
Quote Benjamin Krajmalnik:
If the parameters sent to the form result in a recordset being returned then
the "add" button will not be visible. If no recordset is returned then the
"add" button becomes visible.
Have you placed the redirect code in there as I suggested to see if the
event code is firing?
Can you post the code which you have on the On_Click server side embed?
_________________
---On a campaign for more examples and better docs! |
 |
 |
Benjamin Krajmalnik
|
| Posted: 02/17/2005, 3:59 PM |
|
This is a multi-part message in MIME format.
------=_NextPart_000_01CB_01C51512.729D8E50
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
OK.
This is a snippet of code from the pages' .asp (not the events).
Sub Operation()
If NOT ( Visible AND FormSubmitted ) Then Exit Sub
If FormSubmitted Then
PressedButton =3D IIf(EditMode, "Button_Update", "Dead")
If Not IsEmpty(CCGetParam("Dead", Empty)) Then
PressedButton =3D "Dead"
ElseIf Not IsEmpty(CCGetParam("Button_Update", Empty)) Then
PressedButton =3D "Button_Update"
ElseIf Not IsEmpty(CCGetParam("Button_Cancel", Empty)) Then
PressedButton =3D "Button_Cancel"
End If
End If
Redirect =3D "AccountList.asp?" & CCGetQueryString("QueryString", =
Array("ccsForm", "Dead", Button_Update", "Button_Cancel", =
"AccountNumber"))
If PressedButton =3D "Button_Cancel" Then
If NOT Button_Cancel.OnClick Then
Redirect =3D ""
End If
ElseIf Validate() Then
If PressedButton =3D "Dead" Then
If NOT Dead.OnClick() Then
Redirect =3D ""
End If
ElseIf PressedButton =3D "Button_Update" Then
---> If NOT Button_Update.OnClick() OR NOT UpdateRow() Then
Redirect =3D ""
End If
End If
Else
Redirect =3D ""
End If
End Sub
As you can see, the sequence of events is as follows:
First, data is validated.
After the data is validated, the system checks which button was pressed.
In the case of your update button, even if the code runs it may still be =
updating the record since it is on the same execution line.
I think your best bet is to place your code in the OnValidate embed.
In the embed, add the following:
if whatever condition is not met then
NewRecord1.Errors.Adderror("Your error message here")
end if
The validate functino follows:
Function Validate()
Dim Validation
ValidatingControls.Validate
CCSEventResult =3D CCRaiseEvent(CCSEvents, "OnValidate", Me)
Validate =3D ValidatingControls.isValid() And (Errors.Count =3D 0)
End Function
The way to force the validation to fail is by adding the error message.
This should get you going.
BTW, this is the way I go about finding how to do something in =
CodeCharge.
IT is tantamount to studying the ABC classes in Calrion to figure out =
which embed to use.
Frustrating as heck sometimes, but I have not been as yet unable to do =
something I wanted.
In some cases, I do not find an embed that will get the job done, in =
which case I modify the base page slightly (or either common.asp or =
classes.asp)
------=_NextPart_000_01CB_01C51512.729D8E50
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1479" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY><FONT size=3D2>
<P>OK.</P>
<P>This is a snippet of code from the pages' .asp (not the events).</P>
<P>Sub Operation()</P>
<P>If NOT ( Visible AND FormSubmitted ) Then Exit Sub</P>
<P>If FormSubmitted Then</P>
<P> PressedButton =3D IIf(EditMode, "Button_Update", =
"Dead")</P>
<P> If Not IsEmpty(CCGetParam("Dead", Empty)) Then</P>
<P> PressedButton =3D "Dead"</P>
<P> ElseIf Not IsEmpty(CCGetParam("Button_Update", =
Empty))=20
Then</P>
<P> PressedButton =3D =
"Button_Update"</P>
<P> ElseIf Not IsEmpty(CCGetParam("Button_Cancel", =
Empty))=20
Then</P>
<P> PressedButton =3D =
"Button_Cancel"</P>
<P> End If</P>
<P>End If</P>
<P>Redirect =3D "AccountList.asp?" & CCGetQueryString("QueryString", =
Array("ccsForm", "Dead", Button_Update", "Button_Cancel", =
"AccountNumber"))</P>
<P>If PressedButton =3D "Button_Cancel" Then</P>
<P> If NOT Button_Cancel.OnClick Then</P>
<P> Redirect =3D ""</P>
<P> End If</P>
<P>ElseIf Validate() Then</P>
<P> If PressedButton =3D "Dead" Then</P>
<P> If NOT Dead.OnClick() Then</P>
<P> Redirect =3D =
""</P>
<P> End If</P>
<P> ElseIf PressedButton =3D "Button_Update" Then</P>
<P> ---> If NOT Button_Update.OnClick() OR NOT =
UpdateRow()=20
Then</P>
<P> Redirect =3D =
""</P>
<P> End If</P>
<P> End If</P>
<P>Else</P>
<P> Redirect =3D ""</P>
<P>End If</P>
<P>End Sub</P>
<P>As you can see, the sequence of events is as follows:</P>
<P>First, data is validated.</P>
<P>After the data is validated, the system checks which button was =
pressed.</P>
<P>In the case of your update button, even if the code runs it may still =
be=20
updating the record since it is on the same execution line.</P>
<P>I think your best bet is to place your code in the OnValidate =
embed.</P>
<P>In the embed, add the following:</P>
<P> if whatever condition is not met then</P>
<P> =
NewRecord1.Errors.Adderror("Your error=20
message here")</P>
<P> end if</P>
<P> </P>
<P>The validate functino follows:</P>
<P>Function Validate()</P>
<P>Dim Validation</P>
<P> ValidatingControls.Validate</P>
<P> CCSEventResult =3D CCRaiseEvent(CCSEvents, =
"OnValidate",=20
Me)</P>
<P> Validate =3D ValidatingControls.isValid() And =
(Errors.Count=20
=3D 0)</P>
<P>End Function</P>
<P><FONT face=3DArial></FONT> </P>
<P>The way to force the validation to fail is by adding the error =
message.</P>
<P>This should get you going.</P>
<P>BTW, this is the way I go about finding how to do something in=20
CodeCharge.</P>
<P>IT is tantamount to studying the ABC classes in Calrion to figure out =
which=20
embed to use.</P>
<P>Frustrating as heck sometimes, but I have not been as yet unable to =
do=20
something I wanted.</P>
<P>In some cases, I do not find an embed that will get the job done, in =
which=20
case I modify the base page slightly (or either common.asp or=20
classes.asp)</P></FONT></BODY></HTML>
------=_NextPart_000_01CB_01C51512.729D8E50--
|
|
|
 |
|