differing option values and display values in selects

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

differing option values and display values in selects

stevepiercy
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
<[hidden email]>                  <http://www.StevePiercy.com/>

--
#############################################################
This message is sent to you because you are subscribed to
the mailing list <[hidden email]>.
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
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/
Reply | Threaded
Open this post in threaded view
|

Re: differing option values and display values in selects

Conny Larsson

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
> <[hidden email]>                  <http://www.StevePiercy.com/>
>
> --
> #############################################################
> This message is sent to you because you are subscribed to
> the mailing list <[hidden email]>.
> To unsubscribe, E-mail to: <[hidden email]>
> Send administrative queries to  <[hidden email]>
> 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 <[hidden email]>.
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
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/
Reply | Threaded
Open this post in threaded view
|

Re: differing option values and display values in selects

stevepiercy
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, [hidden email] (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
>> <[hidden email]>                  <http://www.StevePiercy.com/>
>>
>> --
>> #############################################################
>> This message is sent to you because you are subscribed to
>> the mailing list <[hidden email]>.
>> To unsubscribe, E-mail to: <[hidden email]>
>> Send administrative queries to  <[hidden email]>
>> 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
<[hidden email]>                  <http://www.StevePiercy.com/>

--
#############################################################
This message is sent to you because you are subscribed to
the mailing list <[hidden email]>.
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
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/
Reply | Threaded
Open this post in threaded view
|

Re: differing option values and display values in selects

Johan Solve-2
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, [hidden email] (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
>>> <[hidden email]>                  <http://www.StevePiercy.com/>
>>>
>>> --
>>> #############################################################
>>> This message is sent to you because you are subscribed to
>>> the mailing list <[hidden email]>.
>>> To unsubscribe, E-mail to: <[hidden email]>
>>> Send administrative queries to  <[hidden email]>
>>> 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:[hidden email]
 (spam-safe email address, replace '-' with 'a')

--
#############################################################
This message is sent to you because you are subscribed to
the mailing list <[hidden email]>.
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
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/