Problems, need help? Have a tip or advice? Post it here.
3 posts Page 1 of 1
Hello All!
Greetings from GenXCoders!

I am have a time field that needs to have separate dropdown for HH and MM.

Design wise I have coded it as follows:
Code: Select all
<div class="input-group hidden-sm hidden-xs">
                                                <span class="input-group-addon">Start Time</span>
                                                <!-- Web -->
                                                <select type="text" name="f_co_stimehh" id="f_co_stimehh" class="form-control superSelect" aria-describedby="stimehh" style="width: 50%;">
                                                    <option value="HH" selected disabled>HH</option>
                                                    <cms:repeat count='24' start_count='00'>
                                                    <option value="<cms:show k_count />"><cms:show k_count /></option>
                                                    </cms:repeat>
                                                </select>
                                                <select type="text" name="f_co_stimemm" id="f_co_stimemm" class="form-control superSelect" aria-describedby="stimemm" style="width: 50%;">
                                                    <option value="MM" selected disabled>MM</option>
                                                    <cms:repeat count='60' start_count='00'>
                                                        <option value="<cms:show k_count />"><cms:show k_count /></option>
                                                    </cms:repeat>
                                                </select>
                                            </div>


I want to save the value in a hidden field as:
Code: Select all
<cms:hide><cms:input name="co_stime" id='stime' type="bound" /></cms:hide>


How can that be done?

The bound field is defined as:
Code: Select all
<cms:editable name='co_stime' label='Start time' type='text' order='4' />


Regards,
GenXCoders
Image
where innovation meets technology
Hi,

I think you should create the two dropdowns using <cms:input> (instead of raw HTML that you are using currently).
This way, we can easily and securely access their submitted values in the form's success block (by prepending 'frm_' to their names, as you know).

Don't use the target 'co_stime' text field at all on the form. Instead now set its value explicitly using the values of the two dropdowns in <cms:db_persist_form /> e.g. as follows
Code: Select all
<cms:db_persist_form
    co_stime="<cms:show frm_f_co_stimehh />:<cms:show frm_f_co_stimemm />"
/>

Hope it helps.
@KK Sir,
I tried and it worked like a charm.
Regards,
Aashish
Image
where innovation meets technology
3 posts Page 1 of 1
cron