Author Archive
preg_match for Japanese forms
郵便番号 /^[0-9]{3}-[0-9]{4}$/ if (preg_match(‘/^[0-9]{3}-[0-9]{4}$/’, $str)) { 電話番号 /^[0-9]{2,4}-[0-9]{2,4}-[0-9]{3,4}$/ if (preg_match(‘/^[0-9]{2,4}-[0-9]{2,4}-[0-9]{3,4}$/’, $str)) { Emailアドレス |^[0-9a-z_./?-]+@([0-9a-z-]+\.)+[0-9a-z-]+$| if (preg_match(‘|^[0-9a-z_./?-]+@([0-9a-z-]+\.)+[0-9a-z-]+$|’, $str)) { 全角空白のトリム /^ *(.*?) *$/u $str = preg_replace(‘/^ *(.*?) *$/u’, ‘$1’, $str); 半角+全角空白のトリム /^[\s ]*(.*?)[\s ]*$/u $str = preg_replace(‘/^[\s ]*(.*?)[\s ]*$/u’, ‘$1’, $str);
Posted in etc | Comments Off on preg_match for Japanese forms
When Chrome fails to load resource
Failed to load resource: net::ERR_CACHE_MISS Check Disable DirectWrite(Windows) at chrome://flags if the website has a multibyte character.
Posted in etc | Comments Off on When Chrome fails to load resource
Use a bracket in CSS
To control multiple class names in css. input[readonly=’readonly’] { display:none; }; .views-field[class*=’views-field-view’] { display:block; }input[readonly=’readonly’] { display:none; }; .views-field[class*=’views-field-view’] { display:block; }
Posted in CSS | Comments Off on Use a bracket in CSS
Unlimited cardinality pre-populate fields
I am trying to solve this and my only issue is that I want to keep this field as unlimited cardinality with fields in Field Collection already displayed to the user when they create the other reference node. function module_form_alter(&$form, &$form_state, $form_id) { if($form_id == ‘form_name’) { $reference_query = new EntityFieldQuery(); $reference_query->entityCondition(’entity_type’, ‘node’) ->entityCondition(’bundle’, ‘reference’) ->propertyOrderBy(’created’, ‘DESC’) ->range(0, 1); $reference_result = $reference_query->execute(); $reference_nid = array_keys($reference_result[’node’]); $reference_refer = node_load($reference_nid); $items_count = count($reference_refer->field_field_name[’und’]); $field_name = ‘field_field_name’; $form_theme = $form[$field_name][’und’][’#theme’]; // Remove delete and add more buttons $form[$field_name][’und’][0][’remove_button’][’#access’] = FALSE; $form[$field_name][’und’][’add_more’][’#access’] = FALSE; $items = &$form_state[’field’][$field_name][’und’]; if ($items_count > 1 and $items[’items_count’] != $items_count) { $items[’items_count’] = $items_count; $items[’field’][’cardinality’] = $items_count; […]
Tags: drupal
Posted in Drupal | Comments Off on Unlimited cardinality pre-populate fields
Align float center
Sometimes float-left or float-right cannot make a center align and we can use a margin with Width but there is a simple way as below. #test { float: right; position: relative; left: -50%; } #test li { float: left; position: relative; left: 50%; border: 1px solid red; }#test { float: right; position: relative; left: -50%; } #test li { float: left; position: relative; left: 50%; border: 1px solid red; } <ul id="test"> <li>red</li> <li>yellow</li> <li>white</li> <li>blue</li> <li>black</li> </ui><ul id="test"> <li>red</li> <li>yellow</li> <li>white</li> <li>blue</li> <li>black</li> </ui>
Posted in CSS | Comments Off on Align float center
Protected: 3.PC 마케팅
There is no excerpt because this is a protected post.
Posted in IT Marketing | Comments Off on Protected: 3.PC 마케팅
Protected: 3.SDN OpenFlow
There is no excerpt because this is a protected post.
Posted in Futuristic Technology | Comments Off on Protected: 3.SDN OpenFlow