Client side Validation on Field

Posted by john cruze on 02-Jun-2016 02:36

Hi,

I am using client side validation using script component on field event . However my problem is that, record is saved in both cases either validation is true or false . Could you please suggest me how could I prevent record saving when validation on field is false..

Thanks.

All Replies

Posted by Mohammed Siraj on 06-Jun-2016 01:13

Client-side validation support is NOT extensible in Rollbase.

If required, you can write a custom scirpt component and prevent the form from being submitted in case any of the fields has invalid input as per your custom validation rules.

However, the right approach would be to write custom validation rules against field definition on server-side. This way, validation rules will also be enforced when field value is set via API, in addition to UI form pages.

Posted by john cruze on 08-Jun-2016 02:14

Hi Siraj ,

Thanks a lot for your suggestion. Could you please guide me with small set of code for custom validation rules against field definition on server-side. Let say my field name is "Amount" and I want if amount is  > = 2000 then user could not create record and get a message "Amount is less then 2000".

Thanks a lot.

John.

Posted by Mohammed Siraj on 08-Jun-2016 02:42

Sure John.

In Field Definition -> Validation. Add the following code snippet:

if({!amt#value} < 2000){

 return 'Amount should be atleast 2000';

}

where 'amt' is integration code for a field called Amount.

Posted by john cruze on 08-Jun-2016 02:54

Thank you Siraj,

Its working...

Regards.

John.

Posted by john cruze on 08-Jun-2016 05:18

Hi Siraj,

Could you please suggest me why this code is not working  .

if(!rbv_api.getFieldValue('CheckValidation', {!id}, 'cvCity').matches("[a-zA-Z]+"))

 {

    return 'Only Character Allowed';

 }

here I am placing server side validation on "City" field that only accept character value. Please let me know if any correction required.

Thanks.

John.

Posted by Shiva Duriseati on 08-Jun-2016 06:07

Hi John,

Can you try below code?

var value="{!cvCity#value}";

if(!value.match(/^[a-zA-Z]*$/))

{

  return 'Only Character Allowed';

}

Regards,

Shiva

Posted by john cruze on 08-Jun-2016 06:24

Thanks Shiva,

Now It is working.

Regard.

John.

Posted by john cruze on 10-Jun-2016 02:57

Hi All,

Could you guys please suggest me how could I create a button on new record creating page.

Thanks,

John.

Posted by Shivani Silveri on 10-Jun-2016 03:28

Hi John,

Please refer to this link documentation.progress.com/.../ .

Thanks,

Shivani.

Posted by john cruze on 10-Jun-2016 06:20

Hi Shivani,

Thank you so much .

On click of custom button no event occurs ... could you Please suggest How to bind events on custom buttons in rollbase.

Regards.

John.

Posted by Chandrasekhar Gontla on 10-Jun-2016 07:03

Hi John,

When you update any field using custom button, you can fire an event of that field.

Events page will be available in object definition

Object Definition > Fields section

Observe that 'Events' link will be there for all types of fields.

Thanks and Regards,

Chandu.

This thread is closed