This project has moved. For the latest updates, please go here.

Form for newsletter

Jan 29, 2016 at 9:26 AM
Edited Jan 29, 2016 at 9:44 AM
Hi I tring to create a sample form for a newsletter subscription
I insert an email and I need :
-style submit button (I don't find how)
-create a privacy text and I need a check box (reqired)

I try insert in schema.json this
{
    "type": "object",
    "properties": {

        "Email": {
            "title": "Email",
            "type": "string",
            "required": true
        },
            "Consenso": {
            "title": "Consenso 234",
            "type": "checkbox",
            "required": true
        }

    }
} 
and this in options.it-IT.json
{
  "fields": {
    "Email": {
      "type": "email"
    },
    "Consenso": {
    "type": "checkbox"
    }
  }
}
I need :
-The checkbox appear but it isn't mandatory?
  • to insert a localized text between the email and the check box but I dont'understand how to inser it - I need add text near the check box! Is this possible?
  • remove from the email error message the info@cloudcms.com where is this, it's not on the resx fle?
This is my actual result

Image

Thanks for your support
Fabio
Coordinator
Jan 29, 2016 at 1:13 PM
Hi,

1) style submit button (I don't find how)
you can add css to the class btn-openform
for exemple in the css file of openform (Edit template files)

2) create a privacy text and I need a check box (reqired)
-The checkbox appear but it isn't mandatory?

in schema :
"privacy": {
            "type": "boolean",
            "required": true
}
in options :
"privacy": {
        "rightLabel": "privacy ........",
        "validate":true
}
in javascript :
 $(document).on("postRender.openform", function (event, control, moduleid, sf ) {

   // Enforce validation of checkbox
   var cbField = control.childrenByPropertyId["privacy"];
   
   cbField.options.validator = function(callback) {
     var value = this.getValue();

     if (value == false) {
       callback({
         "status": false,
         "message": "This field is not optional."
       });
       return;
     }
     callback({
       "status": true
     });
   };
   
});
4) I need add text near the check box! Is this possible?


in option file

"rightLabel": "Do you like Alpaca?"

5) remove from the email error message the info@cloudcms.com where is this, it's not on the resx fle?

in view layout :
{
  
"messages" :{
    "invalidEmail": "Ongeldig e-mailadres, vb.: info@satrabel.be"
 }

}