Form Design Question
#1
I always think why MyBB includes all those "Go" buttons for form designs (like, say 'language select') when the function is called through:

onchange="functionName();"

Is there any specific reason behind this?
Reply
#2
In case Javascript is disabled?
PGP Key (Fingerprint: 23B6 F4C0 FE2D 45AA 61A0 1E86 DB87 09DC DD87 6E40)
Reply
#3
So, what if I just wrap the {$gobutton} in an id

<span id="goBut">{$gobutton}</span>

and hide it through jQuery:

<script type="text/javascript">jQuery('#goBut').hide();</script>

So, if javascript is disabled the onChange will not work and at the same time the button hide function will not occur.
Is it right to do? Maintaining good coding standard / practice?
Reply
#4
I'm not one to talk about coding standards, as I've probably broken several rules.

But that should work.
PGP Key (Fingerprint: 23B6 F4C0 FE2D 45AA 61A0 1E86 DB87 09DC DD87 6E40)
Reply
#5
(2013-01-27, 08:03 AM)effone Wrote: So, what if I just wrap the {$gobutton} in an id

<span id="goBut">{$gobutton}</span>

and hide it through jQuery:

<script type="text/javascript">jQuery('#goBut').hide();</script>

So, if javascript is disabled the onChange will not work and at the same time the button hide function will not occur.
Is it right to do? Maintaining good coding standard / practice?

The way it's done already is much simpler, and requires less markup.
Reply
#6
Alright, thanks Josh and Eric for clarifications Big Grin
Reply
#7
<script type="text/javascript">jQuery('#goBut').hide();</script>

in this code, if javascript is disabled the onChange will not work...
Reply
#8
(2013-02-01, 06:27 AM)confused76 Wrote: <script type="text/javascript">jQuery('#goBut').hide();</script>

in this code, if javascript is disabled the onChange will not work...

http://community.mybb.com/thread-133571-...#pid966931

^^^ R-E-A-D ^^^

By the way, what is javascript? I'm confused 76 times.
Reply
#9
(2013-02-01, 04:48 PM)effone Wrote: By the way, what is javascript? I'm confused 76 times.

JavaScript is client-side PHP. JQuery is written in JavaScript.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)