0

An easy one here, I think!

I have a channel field that is a text field. This field holds a numerical value, (between 1-12)

I am creating a safecracker form to add entires from the front end. Can I use a select drop down with the values 1-12 to complete this text field or does the actual channel field need to be a dropdown type?

2 Answers 2

1

Yep.

<select name="your_custom_field_name">
  <option value="1">1</option>
  <option value="2">2</option>
</select>

And if you're using safecracker to edit, this is what I use:

<select name="your_custom_field_name">
  <option value="1"{if '{your_custom_field_name}'=='1'} selected{/if}>1</option>
  <option value="2"{if '{your_custom_field_name}'=='2'} selected{/if}>2</option>
</select>
0
1

I've not directly tested but I'm fairly sure it's no problem to use a dropdown field on the front-end via a safecracker form to pass that value. Both a regular text input and the select boxes rely on the value parameter and this will be what's sent through on form submission so it should be fine.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.