Adding placeholder text to Drupal 7 user_register_form - forms

So I can get the email and username field to work just fine.
here is the code
if ( TRUE === in_array( $form_id, array('user_register_form'))) {
$form['account']['name']['#attributes']['placeholder'] = t(' Username ');
$form['account']['name']['#title_display'] = "invisible";
$form['account']['mail']['#attributes']['placeholder'] = t(' Your Email ');
$form['account']['mail']['#title_display'] = "invisible";
}
This works fine. But it seems the person who set this up is using custom field in the form because the it shows:
name="profile_installer_contractor[field_installer_first_name][und][0][value]"
How can I get these fields to show the placeholder text? I have tried:
$form['account']['field_installer_first_name'][und][0]['value']['#attributes']['placeholder'] = t(' First Name ');
but that doesn't seem to work. Any help is greatly appreciated.
Thanks,
Kevin

nevermind I figured it out on my own.
$form[profile_installer_contractor]['field_installer_first_name'][und][0]['value']['#attributes']['placeholder'] = t(' First Name ');
this worked

Related

Add formhandler field data to subject

My goal is to have the Formhandler log UID inside the Admin emails subject.
Inside of my email template I'm using
###value_tx_formhandler_log_inserted_uid### to insert a unique id.
I need to get this value into my Admin emails subject. E.g.
"Order ID: ###value_tx_formhandler_log_inserted_uid###"
I've read various forum posts, each do something different and I ended up with this snippet:
plugin.Tx_Formhandler.settings.predef.form {
# TEMPLATE MARKERS
name = Form1
templateFile = typo3template/typo3/ext/formhandler/form1/default.html
markers {
name = TEXT
name.value = Form1
}
finishers {
1.config {
class = Tx_Formhandler_Finisher_Mail
subject = TEXT
subject.value = ###GP:tx_formhandler_log_inserted_uid###
}
}
[...]
which just yields "{$formhandler.admin.subject}" as the subject.
I also tried other variations like
###LLL:tx_formhandler_log_inserted_uid### or tx_formhandler_log_inserted_uid
The backend field "subject" is empty.
Pasting the HTML placeholder into the backend field didn't work either.
I can't get this to work.
In what way can you access the id you want to insert?
From the notation GP:tx_formhandler_log_inserted_uid I would assume a GET/POST value.
For using this value in typoscript you need to do it like this (or similar: dataWrap):
subject = TEXT
subject.data = GP:tx_formhandler_log_inserted_uid
subject.noTrimWrap = |Order ID: ||
The notation LLL:tx_formhandler_log_inserted_uid would be a language specific text (you would also insert by .data) but it would be a static text for each language.
After a lot of trial and error, I got it working.
First of all, I forgot to specify that I want to configure the admin mail.
Adding admin { fixed the problem of getting only {$formhandler.admin.subject}.
The UID value itself can be accessed with GP:formhandler|tx_formhandler_log_inserted_uid
I combined that with the noTrimWrap as suggested by #bernd-wilke-πφ
The final snippet looks like this:
finishers {
1 {
class = Tx_Formhandler_Finisher_Mail
config {
admin {
subject = TEXT
subject.data = GP:formhandler|tx_formhandler_log_inserted_uid
subject.noTrimWrap = |Order number: ||
}
}
}
}

How to insert an option value into a select tag with CasperJS?

Well, the question is very self-explanatory.
Right now, I'm front of a form which has a select tag with a couple of options already. But I must insert a new one, with a different value that I will receive from a .json file.
The thing is: I haven't been able to find a suitable solution from the CasperJS documentation.
I've tried something like this:
this.fill('form.coworkerdiscountcode', {
'CoworkerDiscountCode.DiscountCode': ['Value1']
});
But no results. Any ideas?
Thanks in advance.
You can execute any javascript code by passing it to casper.evaluate like this:
casper.evaluate(function() {
var x = document.getElementById("coworkerdiscountcode");
var option = document.createElement("option");
option.text = "Kiwi";
x.add(option);
});

Set item email field in Podio

I'm having a hard time trying to guess how to set the item email field value, since there is nothing about this in the documentation (http://podio.github.io/podio-php/fields/)
I have tried :
$item->fields['email']->values = array("type"=>"work","value"=>"a#a.com");
$item->fields['email']->values = array("value"=>"a#a.com");
$item->fields['email']->values = "a#a.com";
$item->fields[$field_id]->value ="i#i.com";
$item->fields[$field_id]->type ="work";
$item->save();
Nothing works, please help! Thank you!
I have figured it out , here is the code that works (if anyone runs into the same problem)
$field_id = 'email';
$emails=$item->fields[$field_id]->values;
$item->fields[$field_id]->values =array('value'=>"i#oooo.com",'type'=>'work');
$item->save();

Typoscript: Display register value as text

I'm using the extension seo_dynamic_tag, which is a fantastic plugin for TYPO3 SEO purposes.
It uses registers to store the generated meta description and keywords. Later on in the script, the page metadata is filled in from these registers:
page {
meta {
description {
field >
data = register:description
}
keywords {
field >
data = register:keywordss
}
}
1000 < temp.seo
}
So far it works like charm.
But in addition I'd like to display a TEXT object on the page with the meta description on the bottom. The text should read the meta description and some other stuff. That's where I need your help.
I tried to do the "magic" like this:
temp.description = COA
temp.description {
10 = TEXT
10.value = Meta description: {register:description}
stdWrap.insertData = 1
}
lib.footer < temp.description
This simply does not work. If I want to display something else, for example {page:title} or {date:y-m-d}, data insertion works. For register:xxx it doesn't.
I already spent lots of hours to google out my desired solution, but no success :(
Do you have any idea what I'm missing here?
I'm using TYPO3 4.5.3 (I know I should update ;)).
Many thanks in advance for your help! :)
Your stdWrap.insertData = 1 is applied to your COA-object, and not to your TEXT-object. You can instead set 10.insertData = 1 or just write the following:
10 = TEXT
10.data = register:description

typoscript assign page:id to plugin attribute

so all I actually want to do is something like
plugin.tx_felogin_pi1.redirectPageLogin = page:id
where the page:id is the PID of the current page. replacing 'page:id' with a number works as expected BUT I do need the PID instead of a fixed number. any hints are welcome
redirectPageLogin has to be a single int value:
$redirect_url[] = $this->pi_getPageLink(intval($this->conf['redirectPageLogin']));
Alternative: use as $redirMethod: getpost or referer
I think that'll fit four you.
Try
plugin.tx_felogin_pi1.redirectPageLogin = TSFE:id
or
plugin.tx_felogin_pi1.redirectPageLogin = {TSFE:id}
or
plugin.tx_felogin_pi1.redirectPageLogin.cObject = TEXT
plugin.tx_felogin_pi1.redirectPageLogin.cObject.insertData = 1
plugin.tx_felogin_pi1.redirectPageLogin.cObject.value = {TSFE:id}