te')); return $arr; } /* 遍历用户所有主题 * @param $uid 用户ID * @param int $page 页数 * @param int $pagesize 每页记录条数 * @param bool $desc 排序方式 TRUE降序 FALSE升序 * @param string $key 返回的数组用那一列的值作为 key * @param array $col 查询哪些列 */ function thread_tid_find_by_uid($uid, $page = 1, $pagesize = 1000, $desc = TRUE, $key = 'tid', $col = array()) { if (empty($uid)) return array(); $orderby = TRUE == $desc ? -1 : 1; $arr = thread_tid__find($cond = array('uid' => $uid), array('tid' => $orderby), $page, $pagesize, $key, $col); return $arr; } // 遍历栏目下tid 支持数组 $fid = array(1,2,3) function thread_tid_find_by_fid($fid, $page = 1, $pagesize = 1000, $desc = TRUE) { if (empty($fid)) return array(); $orderby = TRUE == $desc ? -1 : 1; $arr = thread_tid__find($cond = array('fid' => $fid), array('tid' => $orderby), $page, $pagesize, 'tid', array('tid', 'verify_date')); return $arr; } function thread_tid_delete($tid) { if (empty($tid)) return FALSE; $r = thread_tid__delete(array('tid' => $tid)); return $r; } function thread_tid_count() { $n = thread_tid__count(); return $n; } // 统计用户主题数 大数量下严谨使用非主键统计 function thread_uid_count($uid) { $n = thread_tid__count(array('uid' => $uid)); return $n; } // 统计栏目主题数 大数量下严谨使用非主键统计 function thread_fid_count($fid) { $n = thread_tid__count(array('fid' => $fid)); return $n; } ?>c# - how to change textbox input language in web application - Stack Overflow
最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c# - how to change textbox input language in web application - Stack Overflow

programmeradmin2浏览0评论

Im workin on a web application , and I have a form on which I have a textbox that users must fill it using arabic language.
how can I control it using javascript ?
Changing the default language of the operting system to arabic will solve my problem.
How can i change the default language to arabic using javascript ???
and is it the best approch to do it??
Is their another method ?

Im workin on a web application , and I have a form on which I have a textbox that users must fill it using arabic language.
how can I control it using javascript ?
Changing the default language of the operting system to arabic will solve my problem.
How can i change the default language to arabic using javascript ???
and is it the best approch to do it??
Is their another method ?

Share Improve this question asked Dec 9, 2010 at 8:40 GraceGrace 1,26521 silver badges48 bronze badges 3
  • Best you can do is setting dir="rtl" inside the textbox. – Shadow Wizard Commented Dec 9, 2010 at 9:08
  • Did you try my solution? – Jahan Zinedine Commented Dec 9, 2010 at 9:15
  • 1 @shadow : dir="rtl" will just change the direction..not the input language.. @Jani: im trying it now – Grace Commented Dec 9, 2010 at 9:25
Add a ment  | 

5 Answers 5

Reset to default 5

Refer to this question and it will solve your problem pal Arabic text box

EDIT: Change the code to this

$().ready(function () {
    $("input#NameTextBox").attr("lang", "fa");
});

a better solution may be:

Farsi type java script code

If using jquery in your application is possible you may take a look at the jquery direction plugin. You may see it in action here.

If you want to limit the characters entered into a text box there is no use to set the language of the operating system.

You can use a RegularExpressionValidator or a CustomValidator which checks the characters entered, and displays a message saying those characters are not allowed.

Or add some form of javascript which limits the same. You have to decide if you want to block characters as they are typed, or display a message.

You want to change the default language of the OS using JS? Never, ever, going to happen - your web page has absolutely no rights over the client machine.

As for making the page itself "be arabic", I really don't think there's anything you can do about this from a culture point of view, but in terms of merely making the page right-to-left there's a lot that needs to be done in terms of mirroring content, but you'll definitely want to know about direction. You're best bet for the rest is to deal with culture and cultural validation on the server-side but it's going to depend enormously on what exactly you're trying to force, e.g. actual language validation assumes things like dictionaries and grammar checking and that would be something you probably want to look at 3rd party solutions for.

发布评论

评论列表(0)

  1. 暂无评论