Expand my Community achievements bar.

Validate white space and Null entry in adobe Campaign input Form

Avatar

Level 1

Hi,

I am currently working on adobe campaign input forms which will store user data such as First Name, email, ID, Groups. All the fields are of type="String" For validation, I use in input form           Mandatory field, Please Enter your First Name!     

<leave>      

<check expr="@firstName!=''">

      <error>Mandatory field, Please Enter your First Name!</error>

    </check>

  </leave>

But with this I am able to validate null entry but if the user enter white space it is stored. I need to get the same alert for white space also. I tried to achieve this through javascript also.

javaScript Code:-

function db-rdValidateJS-validate(name)

{

var x=document.getElementById(name);

var t=x.trim();

if(t.length=0)

{

alert(s+"input is invalid. Enter Correct Input");

}

return 1;

}

Soap call in input form:-
<soapCall name="validate" service="db:rdFile">
<param exprIn="[@firstName]"  type="string"/>
</soapCall>

And method call in data schema:-
<methods>
  <method library="db:rdValidateJs.js" name="validate">
      <parameters>
         <param inout="in" name="firstName" type="String"/>    
</parameters>  
</method>
</methods>

This is also not working "Error while compiling script" Can anyone please provide any how I  can validate white space also?

Thanks,

Arti

3 Replies

Avatar

Level 5

Hi,

I think you should try adding [] on firstName on check expression.

<leave>     

<check expr="[@firstName]!=''">

      <error>Mandatory field, Please Enter your First Name!</error>

    </check>

  </leave>

Thanks!

Avatar

Level 1

Hi @prasannam97453277

I try by adding [] also.

Still not able to validate white space.

Regards,

Arti

Avatar

Level 1

Hi,

The version I am using is 6.1.1 adobe Campaign client console and still not able to validate the white space provided in input fields in input form. The input field is of string type. Can anyone please help me in validating white space ?

Regards,

Arti