Recent Topics

1 Jul 19, 2008 00:00    

My b2evolution Version: Not Entered

Hello.

I am trying to add an additional field to the msg form but am having trouble with the 'funky field' names.

Where are these defined? How can I create a new one?

For example, if I want to add a new field like:

$Form->text( 's', $email_group, 40, T_('Group'), T_('Enter group here.'), 50, 'bComment' );

It doesn't seem too happy with the s being used as a 'funky field' name. Specifically, it confuses the skin, but if I give it one of the other funky field names like f, g, or even the comment ones like i, o, u etc, then it works just fine.

How do I create a new 'funky field' ??

Thanks in advance!

2 Jul 19, 2008 00:29

Hi kurious,
Welcome to the forum.

You can use any name there, try

$Form->text( 'qwerty', $email_group, 40, T_('Group'), T_('Enter group here.'), 50, 'bComment' );

Then you would have to catch it in htsrv/message_send.php

$qwerty_group = param( 'qwerty', 'string', '' );

Now you can do whatever you want with $qwerty_group variable

3 Jul 19, 2008 03:54

Thanks for the welcome and the response.

Yes, that's exactly what I thought should happen. However, it doesn't work.

When I change the field name, the colors of the form field no longer match the skin. The colors only match the skin when I have one of the pre-loaded funky field types.

It's even more obvious when I simply change an existing one in the msgform.

If I just change the 'h' in the email body field to an 'r', for example, the text field no longer shows up with the same colors as the rest of the fields. It's like the skin is no longer recognizing it.

I am a bit new to php/css, so maybe I'm not understanding what role the field name plays with the display characteristics. I can't find any obvious link anywhere in the skins, or in the mysql database.

:-/

4 Jul 19, 2008 04:34

What skin are you using? I've just tried what I wrote above and everything is working perfect.

Fieldset id and input id are generated from field name

<fieldset id="ffield_qwerty">
<div class="label"><label for="qwerty">Qwerty:</label></div>
<div class="input"><input maxlength="50" class="bComment form_text_input" size="40" name="qwerty" id="qwerty" type="text">
 <span class="notes">Your qwerty.</span></div>
</fieldset>

5 Jul 19, 2008 04:37

/inc/_core/ui/forms/_form.class.php lines 584-600:

	/**
	 * Builds a text (or password) input field.
	 *
	 * Note: please use {@link Form::password()} for password fields
	 *
	 * @param string the name of the input field
	 * @param string initial value
	 * @param integer size of the input field
	 * @param string label displayed in front of the field
	 * @param string note displayed with field
	 * @param integer max length of the value (if 0 field_size will be used!)
	 * @param string the CSS class to use
	 * @param string input type (only 'text' or 'password' makes sense)
	 * @return mixed true (if output) or the generated HTML if not outputting
	 */
	function text( $field_name, $field_value, $field_size, $field_label, $field_note = '',
											$field_maxlength = 0, $field_class = '', $inputtype = 'text', $force_to = '' )


In your code the 'bComment' is the class which style (css) determines the looks. I can't see how that goes wrong if you play with the first argument other than this: if you leave out an argument, they shift order, so the seventh argument ('bCmment') is sixth and so there is no class available to style the textfield. In other words: you can leave out arguments in the end (last position), but not in the middle. In the code above you can leave out $force_to and $inputtype and stll use $field_class, but you can't leave out $field_maxlength and still use $field_class.

This doesn't solve your problem, but it might explain the direction in which you should look.

Have fun

6 Jul 19, 2008 05:31

Thank you!

I figured it out, with your (plural) help of course.

My skins style.css file has a line like this:


.bCommentform, input#d, input#f, input#g, input#i, input#o, input#u, textarea#h, .righttext form.search input.SearchField,\
 input#newuser_email, textarea#p {background-color:#6b4634; border:1px solid #9e7d55;}

The input#d, input#f ... g i, o, u are all the 'funky fields'. When I add my new ones to this list, they work just fine.

Thanks a lot.

7 Jul 19, 2008 15:42

So ... what skin does it that way so someone else can benefit from this finding?

8 Sep 02, 2008 05:22

Sorry for the delayed reply...

I'm using the Vastitude skin.


Form is loading...