Validate white space and Null entry in adobe Campaign input Form | Community
Skip to main content
arti1111
November 19, 2019

Validate white space and Null entry in adobe Campaign input Form

  • November 19, 2019
  • 1 reply
  • 9045 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

prasannakumarmarru
Level 4
November 20, 2019

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!

arti1111
arti1111Author
November 20, 2019

Hi @prasannam97453277

I try by adding [] also.

Still not able to validate white space.

Regards,

Arti