Re: [Cppcms-users] get selected value of cppcms::widgets::select
Brought to you by:
artyom-beilis
|
From: ccppprogrammer <ccp...@gm...> - 2013-06-25 11:42:07
|
Data already exists on server (array with data which I filled select html
element), e.g.
cppcms::widgets::select select;
select.add("one", "1");
select.add("two", "2");
select.add("three", "3");
So we just need to take selected key (value="x") from POST and get value
from array of data by the key.
On Wed, Jun 19, 2013 at 7:42 AM, Lee Elenbaas <le...@el...> wrote:
> you have a problem with your HTML
>
> since your option is like this: <option value="2">two</option>
> the text "two" is used as label - and the browser will NOT send it back to
> the server, insead it will send the value "2"
>
> if you want the value sent from the server to be something else - place
> whatever you want on the value attribute of the option
>
>
> On Tue, Jun 11, 2013 at 7:52 PM, ccppprogrammer <ccp...@gm...>wrote:
>
>> ... small typo in sample html element:
>> <select name="test">
>> <option value="1">one</option>
>> <option value="2" selected>two</option>
>> </select>
>>
>> So I need method to get value "two" from test widget.
>>
>>
>> On Tue, Jun 11, 2013 at 8:28 PM, ccppprogrammer <ccp...@gm...
>> > wrote:
>>
>>> Dear All!
>>>
>>> I didn't find method to get selected value of cppcms::widgets::select.
>>> I need method to get value "two" from test widget.
>>> Unfortunately selected() method returns integer index of the list not
>>> value.
>>>
>>> http://cppcms.com/cppcms_ref/1.0.2/classcppcms_1_1widgets_1_1select__base.html
>>>
>>> <select name="test">
>>> <option value="one">1</option>
>>> <option value="two" selected>2</option>
>>> </select>
>>>
>>> Thanks in advance!
>>>
>>>
>>
>>
>> ------------------------------------------------------------------------------
>> This SF.net email is sponsored by Windows:
>>
>> Build for Windows Store.
>>
>> http://p.sf.net/sfu/windows-dev2dev
>> _______________________________________________
>> Cppcms-users mailing list
>> Cpp...@li...
>> https://lists.sourceforge.net/lists/listinfo/cppcms-users
>>
>>
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
> _______________________________________________
> Cppcms-users mailing list
> Cpp...@li...
> https://lists.sourceforge.net/lists/listinfo/cppcms-users
>
>
|