[SOLVED] Placeholder change labeltext to Instructions

laurentmartin 14 Feb, 2013
Hi Greyhead,
We ave recently purchased on your website the file for the placehoder (Using ‘placeholder’ labels).
I would like to replace the placeholder labels by the instruction for user instead.
Meaning, instead of get the Label Text value inside the field, I would like to include the Instructions for user.
Do you have any advice to modify your code to do so ?
Regards
GreyHead 14 Feb, 2013
Hi laurentmartin,

There's a CSS selector that finds the label associated with each input. This would need to be changed to find the User Info <div> instead. I think that would do it.

Bob
laurentmartin 14 Feb, 2013
Hi Bob,

I didn't understand very well, can you clarify a bit better which CSS file you are talking about?

Thanks
GreyHead 14 Feb, 2013
Hi laurentmartin,

It's a CSS selector in the JavaScript that is used to find the inputs and labels.

Bob
laurentmartin 14 Feb, 2013
Hi Bob,
Can you indicate the path of this file on your own install, so that I can find it too.
I have checked in the com_chronoform folder of my install and i didn't find any javascript file related to your form .
GreyHead 15 Feb, 2013
Hi laurentmartin,

It's this line
var label = this.getParent().getElement('label');
Not strictly a CSS3 selector when I look at again it but a string of JavaScript methods. The problem is to find a way to uniquely identify the user-info span starting from the input.

Bob
laurentmartin 15 Feb, 2013
Hi Bob,
Yes i found out this line which select the elements in the div.
In your case you select "Label" and you grab the value in it which is included in the parent div of the element, but i would need to select the value included in the children div of "small-message" .
How can i access it ?
laurentmartin 17 Feb, 2013
Hi Bob,

Any suggestion about this ?


Thank you for your help.

Regards
GreyHead 22 Feb, 2013
Hi laurentmartin,

You could try this:
var label = this.getParent().getElement('.small-message');

Bob
laurentmartin 22 Feb, 2013
Hi Bob,

I replaced the line as you suggested but it didn't work.

Any other suggestion ?
GreyHead 22 Feb, 2013
Hi laurentmartin,

Probably there are other changes needed in the code, you'll need to work through and debug :-(

No-one else has ever asked for this so its not high on the To-Do list :-(

Bob
laurentmartin 22 Feb, 2013
HI Bob,

Thanks for your comment.

As I am new at coding do you have any advice to give about how to debug efficiently the javascript code ?

I mean do you use a software or do you process step by step placing some alert between line to check if javascript go trough ?
laurentmartin 22 Feb, 2013
Edit,
Your suggestion is working properly.

I have replaced all the 'label' by '.small-message' and it works perfect.

A big thank you to you Bob.
GreyHead 22 Feb, 2013
Hi laurentmartin,

Bravo - well done!!

Bob
This topic is locked and no more replies can be posted.