differing option values and display values in selects

View: New views
4 Messages — Rating Filter:   Alert me  

differing option values and display values in selects

by Steve Piercy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On occasion I would like to do stuff like this:

<option value="01">January</option>

How would I do that using the knop_form type?  Would it be possible to pass a map instead of an array, wherein the key/value would become the HTML select option value/display value?

$form -> addfield(
    -name='month',
    -label='Select Month',
    -type='select',
    -options=map('01'='January', ... ,'12'='December'),
    -required);

--steve

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Steve Piercy               Web Site Builder               Soquel, CA
<web@...>                  <http://www.StevePiercy.com/>

--
#############################################################
This message is sent to you because you are subscribed to
the mailing list <knop@...>.
To unsubscribe, E-mail to: <knop-off@...>
Send administrative queries to  <knop-request@...>
List archive http://www.nabble.com/Knop-Framework-Discussion-f29076.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/

Re: differing option values and display values in selects

by Conny Larsson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I think you can use pair array.
-options=array('01' = 'January')

/Conny

22 jun 2009 kl. 16.44 skrev Steve Piercy - Web Site Builder:

> On occasion I would like to do stuff like this:
>
> <option value="01">January</option>
>
> How would I do that using the knop_form type?  Would it be possible  
> to pass a map instead of an array, wherein the key/value would  
> become the HTML select option value/display value?
>
> $form -> addfield(
>    -name='month',
>    -label='Select Month',
>    -type='select',
>    -options=map('01'='January', ... ,'12'='December'),
>    -required);
>
> --steve
>
> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> Steve Piercy               Web Site Builder               Soquel, CA
> <web@...>                  <http://www.StevePiercy.com/>
>
> --
> #############################################################
> This message is sent to you because you are subscribed to
> the mailing list <knop@...>.
> To unsubscribe, E-mail to: <knop-off@...>
> Send administrative queries to  <knop-request@...>
> List archive http://www.nabble.com/Knop-Framework-Discussion-f29076.html
> Project homepage http://montania.se/projects/knop/
> Google Code has the latest downloads at http://code.google.com/p/knop/

____________________________________
Montania System AB
http://www.montania.se

Conny Larsson




--
#############################################################
This message is sent to you because you are subscribed to
the mailing list <knop@...>.
To unsubscribe, E-mail to: <knop-off@...>
Send administrative queries to  <knop-request@...>
List archive http://www.nabble.com/Knop-Framework-Discussion-f29076.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/

Re: differing option values and display values in selects

by Steve Piercy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thank you!  That's the ticket!

Is there anything that hasn't been thought of for Knop?  I mean, just the other day, I was looking for a way to insert text to provide instructions for a field, and there in the docs I found:

$form->renderform(-start);
'Required Fields are noted with a *.';
$form->renderform(-from=1, -to=2);
$form->renderform(-end);

    Contact Us
   
    Required Fields are noted with a *.
    First Name [_____________]*
    Last Name  [_____________]*

--steve


On Monday, June 22, 2009, cl@... (Conny Larsson) pronounced:

>
>I think you can use pair array.
>-options=array('01' = 'January')
>
>/Conny
>
>22 jun 2009 kl. 16.44 skrev Steve Piercy - Web Site Builder:
>
>> On occasion I would like to do stuff like this:
>>
>> <option value="01">January</option>
>>
>> How would I do that using the knop_form type?  Would it be possible  
>> to pass a map instead of an array, wherein the key/value would  
>> become the HTML select option value/display value?
>>
>> $form -> addfield(
>>    -name='month',
>>    -label='Select Month',
>>    -type='select',
>>    -options=map('01'='January', ... ,'12'='December'),
>>    -required);
>>
>> --steve
>>
>> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
>> Steve Piercy               Web Site Builder               Soquel, CA
>> <web@...>                  <http://www.StevePiercy.com/>
>>
>> --
>> #############################################################
>> This message is sent to you because you are subscribed to
>> the mailing list <knop@...>.
>> To unsubscribe, E-mail to: <knop-off@...>
>> Send administrative queries to  <knop-request@...>
>> List archive http://www.nabble.com/Knop-Framework-Discussion-f29076.html
>> Project homepage http://montania.se/projects/knop/
>> Google Code has the latest downloads at http://code.google.com/p/knop/
>
>____________________________________
>Montania System AB
>http://www.montania.se
>
>Conny Larsson
>
>
>
>

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Steve Piercy               Web Site Builder               Soquel, CA
<web@...>                  <http://www.StevePiercy.com/>

--
#############################################################
This message is sent to you because you are subscribed to
the mailing list <knop@...>.
To unsubscribe, E-mail to: <knop-off@...>
Send administrative queries to  <knop-request@...>
List archive http://www.nabble.com/Knop-Framework-Discussion-f29076.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/

Re: differing option values and display values in selects

by Johan Solve-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for the kind words! But if you are looking for gaps in Knop, just check the TODO notes... :-)

Options should be pair array or pair set, yes (I just discovered that knop_form looks for array or series instead, fixed now on SVN as well).
And the options array can contain -optgroup=label to create an nice optiongroup. A single -optgroup element (no pair) will close any optiongroup without opening a new.

If you do this for checkboxes or radios, you will get the optiongroup rendered as well but it's kinda half baked.

Just a topic spin-off.



At 08.44 -0700 2009-06-22, Steve Piercy - Web Site Builder wrote:

>Thank you!  That's the ticket!
>
>Is there anything that hasn't been thought of for Knop?  I mean, just the other day, I was looking for a way to insert text to provide instructions for a field, and there in the docs I found:
>
>$form->renderform(-start);
>'Required Fields are noted with a *.';
>$form->renderform(-from=1, -to=2);
>$form->renderform(-end);
>
>    Contact Us
>
>    Required Fields are noted with a *.
>    First Name [_____________]*
>    Last Name  [_____________]*
>
>--steve
>
>
>On Monday, June 22, 2009, cl@... (Conny Larsson) pronounced:
>
>>
>>I think you can use pair array.
>>-options=array('01' = 'January')
>>
>>/Conny
>>
>>22 jun 2009 kl. 16.44 skrev Steve Piercy - Web Site Builder:
>>
>>> On occasion I would like to do stuff like this:
>>>
>>> <option value="01">January</option>
>>>
>>> How would I do that using the knop_form type?  Would it be possible
>>> to pass a map instead of an array, wherein the key/value would
>>> become the HTML select option value/display value?
>>>
>>> $form -> addfield(
>>>    -name='month',
>>>    -label='Select Month',
>>>    -type='select',
>>>    -options=map('01'='January', ... ,'12'='December'),
>>>    -required);
>>>
>>> --steve
>>>
>>> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
>>> Steve Piercy               Web Site Builder               Soquel, CA
>>> <web@...>                  <http://www.StevePiercy.com/>
>>>
>>> --
>>> #############################################################
>>> This message is sent to you because you are subscribed to
>>> the mailing list <knop@...>.
>>> To unsubscribe, E-mail to: <knop-off@...>
>>> Send administrative queries to  <knop-request@...>
>>> List archive http://www.nabble.com/Knop-Framework-Discussion-f29076.html
>>> Project homepage http://montania.se/projects/knop/
>>> Google Code has the latest downloads at http://code.google.com/p/knop/
>>
>>____________________________________
>>Montania System AB
>>http://www.montania.se
>>
> >Conny Larsson


--
     Johan Sölve    [FSA Member, Lasso Partner]
     Web Application/Lasso/FileMaker Developer
     MONTANIA SOFTWARE & SOLUTIONS
http://www.montania.se   mailto:joh-n@...
 (spam-safe email address, replace '-' with 'a')

--
#############################################################
This message is sent to you because you are subscribed to
the mailing list <knop@...>.
To unsubscribe, E-mail to: <knop-off@...>
Send administrative queries to  <knop-request@...>
List archive http://www.nabble.com/Knop-Framework-Discussion-f29076.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/