English 中文(简体)
多次生育间隔时间
原标题:Drupal date of Birth multiple select
  • 时间:2010-08-10 14:34:12
  •  标签:
  • drupal
  • forms

我想形成一种 form形输出的成分,就像这样。

<>条码>选择日期: [日][月][年]

www.un.org/chinese/sc/presidency.asp

how can I do it with Drupal Form api I wouldn t want to use any fancy plugins / addons.

 $form[ dob ] = array(
   #type  =>  select ,
   #title  => t( select date: ),
   #options  => array(1,2,3),
 );

产出

select date: [day]
最佳回答
  • You can create 3 form items, and using theming to get the desired result.
  • You can create your own form item which create 3 select boxes and a label with hook_elements. This is somewhat time consuming.
问题回答

采用表格A,你可以设立3个单独的选定要素,处理日期选择。 须确定表格要素<代码>#type 至日期

$form[ date_select ] = array (
     #title  => t( Date Selected ),
     #type  =>  date ,
     #description  => t( Please select a date ),
     #default_value  => array(
         month  => format_date(time(),  custom ,  n ),
         day  => format_date(time(),  custom ,  j ),
         year  => format_date(time(),  custom ,  Y ),
    ),
);

这将为月份、日、年份生产3个选箱。

然后,在您提交职务时,仅以产出为准。

$form_state[ values ][ date ][ day ]




相关问题
C# Form Problem: new form losing control and randomly hiding

I m encountering strange behavior with forms on a c# 3.5 app. On a button click, my form1 hides itself, creates a new form2, and shows form2. Form1 also contains the event method triggered when ...

TCPlistener.BeginAcceptSocket - async question

Some time ago I have payed to a programmer for doing multithread server. In the meantime I have learned C# a bit and now I think I can see the slowndown problem - I was told by that guy that nothing ...

RoR: before_save on nested object in form?

I have a form with a nested object (customer < order), and it works except that it keeps creating a new customer record. I d like to have it check to see if an existing customer is already ...

Receive POST from External Form

I have a form on another website (using a different backend) that I want to be able to POST to my Rails application (on a different domain). How do I generate a valid authenticity token for the ...

Getting posted values in MVC PartialView

I ve created a PartialView which I render with Html.RenderPartial, passing the name of the view and the strongly-typed data item to bind to (below): <% Html.RenderPartial("...

Recaptcha - Form Customization

Does anyone know if recaptcha can be fully customize without the default frame. I need the recaptcha image to only be a certain width as well as the input field. Has anyone done this before with ...

Better way to retain form data on manual back redirect?

I have a form that, on submit, requires the customer to look over the data, and then confirm the changes before saving the data. However, I m using a really rough way of retaining data if the user ...

热门标签