on 08-26-2006 9:21 AM
Hi friends,
i need to refresh the values in my text box in run time.
I created a text box,and set the validation for that text box(range of values only it will accept Ex.60-70)
after checking validation in run time the value in text box will refresh, if it is in valid value
1.how to refresh the values in text box after checking the condition
2.how to set the validation for a text box?
plz send code related help.....
Thanks & Regards
SARAN
The validation (In item-event)
if(pVal.ItemUid == "YOURUID" && pval.EventType == BoEventTypes.et_Validate) {
//read the current value
//Validate value from your conditions
if(valid == false) {
BubbleEvent = false;
}
}
I don't understand your quistion of your refresh question...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rasmus Jensen ,
Thanks for your reply...i was already tryed with that logic.but i am not able to refersh the value in text box.
here i am posting my code.
1.i created a text box
2.set validation for that(like entered value will be in between 60-70)
3.now i can able to check the validation.(it displays error message if i entered value other than range specified)
4.<b>after display the message ,the value was remain in text box.i want refresh that value dynamically</b>
If pVal.BeforeAction = True Then
Select Case FormUID
Case "SBOFormEditor_11"
' HISTORY
If ((pVal.ItemUID = "33") And (EventEnum = SAPbouiCOM.BoEventTypes.et_VALIDATE)) Then
oForm = SBO_Application.Forms.ActiveForm
'Card(code)
oItem = oForm.Items.Item("33")
oEdit = oItem.Specific
strFind = oEdit.String
If <b>(ValidPassword(strFind))</b> Then
SBO_Application.MessageBox("Hi Ur in range ")
BubbleEvent = False
'oEdit.String = ""
Else
SBO_Application.MessageBox("Hi u r not in range ")
'oItem = oForm.Items.Item("33")
End If
End If
'End If
End Select
'----
Private Function <b>ValidPassword(ByVal s As String) As</b> Boolean
Dim sPassword As String
Dim bPasswordOk As Boolean
Dim i As Integer
bPasswordOk = False
i = CInt(s) ' Get the password
If (i >= 1) And (i <= 20) Then
bPasswordOk = True
End If
ValidPassword = bPasswordOk
End Function
You need to use the pVal.InnerEvent. This code does the trick (If entered value is not between 10 and 20 the entered value is removed)
if (pVal.EventType == BoEventTypes.et_VALIDATE && pVal.ItemUID=="uid" && !pVal.InnerEvent)
{
Item itm = oForm.Items.Item("uid");
EditText et = (EditText)itm.Specific;
int valueasInt = -1;
if (et.Value != "")
{
valueasInt = Convert.ToInt32(et.Value);
}
if (valueasInt < 10 || valueasInt > 20)
{
//Display error message
et.Value = ""; //Remove value
BubbleEvent = false; //Cancel event
}
}
Perhaps I should explain the reason for the need of the !pVal.InnerEvent. This is needed since the "et.Value = ""; //Remove value" trigger a new valididation (new event through code and if not used you will end up in a infinitive loop of events)
Message was edited by: Rasmus Jensen
User | Count |
---|---|
108 | |
12 | |
11 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.