Skip to content

Instantly share code, notes, and snippets.

@chriwo
Last active June 18, 2018 08:14
Show Gist options
  • Save chriwo/35563b9cd9084b505b9f to your computer and use it in GitHub Desktop.
Save chriwo/35563b9cd9084b505b9f to your computer and use it in GitHub Desktop.
Build a select box of tt_address user. Changes in select box get full information of tt_address user, e.g. phone, address, email. The CSS classes and id's would be work with twitter bootstrap. TYPO3 v6.2
jQuery(document).ready(function() {
var dselect = jQuery('.contact-select').val();
jQuery('.contact div#contact-' + dselect).show();
jQuery('.contact-select').on('change', function() {
var cselect = jQuery(this).val();
jQuery('.contact div.contact-wrapper').hide();
jQuery('.contact div#contact-' + cselect).show();
})
});
lib.contact = COA
lib.contact {
5 = TEXT
5 {
value = {$page.translations.contact.de}
lang.en = {$page.translations.contact.en}
lang.ru = {$page.translations.contact.ru}
lang.es = {$page.translations.contact.es}
wrap = <h3 class="col">|</h3>
}
10 = CONTENT
10 {
table = tt_address
select {
pidInList = 82 // uid of sysfolder
}
renderObj = TEXT
renderObj {
field = name
dataWrap = <option value="{field:uid}">|</option>
dataWrap.override {
cObject = TEXT
cObject.dataWrap = <option value="{field:uid}" selected>{field:name}</option>
cObject.if.value = 7 // uid of user, which would be selected as default
cObject.if.equals.field = uid
}
}
wrap = <select class="form-control contact-select">|</select>
}
20 < .10
20 {
renderObj >
renderObj = COA
renderObj {
10 = COA
10 {
5 = TEXT
5 {
field = uid
wrap = <div class="contact-wrapper" id="contact-|">
}
10 = COA
10 {
10 = TEXT
10 {
field = address
wrap = |<br>
}
20 < .10
20 {
field = country
wrap = |
}
30 < .10
30 {
field = zip
wrap = -|
}
40 < .10
40 {
field = city
wrap = &nbsp;|
}
wrap = <p>|</p>
}
20 = COA
20 {
10 = TEXT
10 {
field = phone
wrap = Tel.:&nbsp;|<br>
}
20 < .10
20 {
field = fax
wrap = Fax:&nbsp;|
}
30 < .10
30 {
field = email
wrap = <br>E-Mail:&nbsp;|
required = 1
}
40 < .10
40 {
field = description
wrap = <br><br>|
required = 1
}
wrap = <p>|</p>
}
wrap = |</div>
}
}
wrap = |
}
wrap = <div class="csc-default csc-layout-0 contact">|</div>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment