Select

Select box

A select field with no placeholder value:

Copy
      "gender" : {
  "type" : "Select",
  "fieldset" : "What is you gender?",
  "config" : {
    "label" : "Gender",
    "options" : [ "male", "female" ]
  }
}
    

A select field with a placeholder value:

Copy
      "drivers-licence" : {
  "type" : "Select",
  "fieldset" : "Do you have driver's licence?",
  "config" : {
    "label" : "Driver's licence",
    "options" : [ "yes", "no" ],
    "placeholder" : "no"
  }
}
    

Reference

type

string

Select

fieldset

string

a user-friendly field label

config

object

objects listed below

config

label

string

user-friendly label before the field

options

array

array of options

placeholder

string

user-friendly placeholder into the field

Copy
      api.query([
  prismic.Predicates.at("document.type", "candidate"),
  prismic.Predicates.at("my.candidate.gender", "male")
], { pageSize : 10 }).then(function(prismicdocs) {
  res.render('index', {
    prismicdocs: prismicdocs.results
  });
});
    
Copy
      $response = $api
    ->forms()->everything
    ->query(
        Predicates::at("document.type", "candidate"),
        Predicates::at("my.candidate.gender", "male"))
    ->ref($api->master())
    ->submit();
    
Copy
      Response response = api.query(
    Predicates.at("document.type", "candidate")),
    Predicates.at("my.candidate.gender", "male")
).submit();
    

Orderings

Select fields can be used to order results. The alphabetical ordering will be used.

Copy
      api.query([
  prismic.Predicates.at("document.type", "candidate")
], { pageSize : 10, orderings : '[my.candidate.gender]' }).then(function(prismicdocs) {
  res.render('index', {
    prismicdocs: prismicdocs.results
  });
});
    
Copy
      $response = $api
    ->forms()->everything
    ->query(
        Predicates::at("document.type", "candidate"),
        Predicates::at("my.candidate.gender", "male"))
    ->orderings('[my.candidate.gender]')
    ->ref($api->master())
    ->submit();
    
Copy
      Response response = api.query(
    Predicates.at("document.type", "candidate")
).orderings("my.candidate.gender").submit();
    
Copy
      p Gender: 
  !=prismicdoc.getText("candidate.gender")

input(type='checkbox' checked=prismicdoc.getBoolean("candidate.drivers-licence")) 
| Has driver's licence
    
Copy
      <p>
    Gender: <?= $prismicdoc->getText("candidate.gender")->getValue() ?>
</p>
<input type="checkbox" checked="<?= $prismicdoc->getBoolean("candidate.drivers-licence") ?>" />
Has driving licence
    
Copy
      <p>
    Gender: ${prismicdoc.getText("candidate.gender").getValue()}
</p>
<input type="checkbox" checked="${prismicdoc.getBoolean("candidate.drivers-licence")}" />
Has driving licence