cancel
Showing results for 
Search instead for 
Did you mean: 

Regrading the refresh values in text box

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

rasmuswulff_jensen
Active Contributor
0 Kudos

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...

Former Member
0 Kudos

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

rasmuswulff_jensen
Active Contributor
0 Kudos

Sorry. I do still not understand you problem. You want to remove the entered value if it is not valid? ... Is your edittext databound?

Former Member
0 Kudos

ya.exactly .........i want to remove the entered value if it is not valid

yes , my edit box was databound with a user table( like @employee).

so how i can remove entered data in editbox if it is not valid?

Thanks & Regards

SARAN

rasmuswulff_jensen
Active Contributor
0 Kudos

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