Custom Function for Selectbox

44 views
Skip to first unread message

Kim Quang Đặng

unread,
Jul 14, 2014, 3:40:48 AM7/14/14
to mootool...@googlegroups.com
Hi all,

I posted this issue on stackoverflow, but I also post here

I have problem with Mootools formcheck js when applying custom function to Selectbox fieldCustom Function will be work fine with Text Field, but Selectbox is NOT.

My dummy code of Custom Function:

var customFunc = function customFuncF(el) {
    el.errors.push('Custom function!!!');
    return false;
};

And There are a simple form that I apply to a text field:

enter image description here

and

<input type="text" class="validate['%customFunc']" id="User_lastName" name="User[lastName]" >

-> It works fine with text field.

But when I apply custom function to Selectbox field, example as Office list in my simple form, it's seems not work and always returns true. My example code for Selectbox

<select id="User_officeId" class="validate['%customFunc']" name="User[officeId]" >
    <option selected="selected" value="">-Select Office-</option>
    <option value="1">Office A</option>
    <option value="2">Office B</option>
</select>

How can I apply custom function to Selectbox field?

Thanks,

Kim Quang Đặng

unread,
Jul 14, 2014, 3:43:06 AM7/14/14
to mootool...@googlegroups.com

Sitthykun LY

unread,
Jul 14, 2014, 6:43:23 AM7/14/14
to mootools-users

you should paste it to http://jsfiddle.net/
It will be easy to trace


--

---
You received this message because you are subscribed to the Google Groups "MooTools Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mootools-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Sitthykun LY
a little developer in the big world \o/
mobile: +85595 7788 39
skype: cityx9
twitter: sitthykun <http://twitter.com/sitthykun>
site: niyum.com

Reply all
Reply to author
Forward
0 new messages