News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Registration fields

Started by bharat_forum, January 27, 2014, 06:56:22 AM

Previous topic - Next topic

bharat_forum

Is it possible to mark some Registration fields which are necessary to fill during registration? Something like little sign near the particular field.

Branko.

Yes but why? For any skipped (required) field user will see an appropriate warning.
Strong people don't put others down, they lift them up.
A clever person solves a problem. A wise person avoids it.

bharat_forum

I noticed that many members have difficulties with registering because they don't fill all necessary fields, that's why it would be easier if they could see which fields should be filled.

kat

Dare we ask who your host is?

margarett

It doesn't show any warning, no. I'm looking at it, see if I can come up with something
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

bharat_forum

What do you mean by warning?

margarett

Warning about the field being required
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

bharat_forum

Oh I see, I really need something like warning or to mark all necessary fields.

margarett

OK, I think I came up with something...


I used, by the lack of a better one, the image for warning = muted, but it serves the purpose. The tooltip text shows up when hovering the mouse over the icon.

Is this good for you?
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Branko.

Quote from: bharat_forum on January 27, 2014, 07:57:51 AM
I noticed that many members have difficulties with registering because they don't fill all necessary fields, that's why it would be easier if they could see which fields should be filled.
By default required is:
username,email adress and password

See screenshots and tell us where is the problem.  ;)
Strong people don't put others down, they lift them up.
A clever person solves a problem. A wise person avoids it.

bharat_forum

margarett, how did you add this sign? I would like to add something like this.

margarett

Yup, I can obviously give you the code ;) But I need to sure if this fits you so that I only code it once :P
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

bharat_forum

Yes, I think it is the best option, I guess I can change this sign if I need? Would be very grateful for your help.

margarett

Final note: this only works for custom profile fields, *NOT* for profile fields (Location, MSN, ICQ, website, etc) and not for the default ones (but those are obviously required)
Still OK?
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

bharat_forum

That's what I actually need to add something like this to custom profile fields as I add a few which are important.

margarett

OK, I'll compile the edits and just add those here. It's just a tweak, doesn't require a MOD, methinks
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

margarett

So, here it goes:

Sources/Profile.php
Find:

default_value, bbc, enclose, placement

Replace with:

default_value, bbc, enclose, placement, show_reg

Find:

'value' => $value,

Add after:

'required' => $row['show_reg'] == 2,

Themes/default/languages/Login.english.php
Add at the end of the file (before ?>):
$txt['required_field'] = 'This is a required field';
Themes/default/Register.template.php
Find:

foreach ($context['custom_fields'] as $field)
echo '
<dt>
<strong', !empty($field['is_error']) ? ' style="color: red;"' : '', '>', $field['name'], ':</strong>
<span class="smalltext">', $field['desc'], '</span>
</dt>
<dd>', $field['input_html'], '</dd>';

Replace with:

foreach ($context['custom_fields'] as $field)
{
echo '
<dt>
<strong', !empty($field['is_error']) ? ' style="color: red;"' : '', '>', $field['name'], ':</strong>
<span class="smalltext">', $field['desc'], '</span>
</dt>
<dd>', $field['input_html'];
if (!empty($field['required']))
echo ' <img src="', $settings['images_url'], '/warning_mute.gif" alt="*" title="', $txt['required_field'], '" />';
echo
'</dd>';
}
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

bharat_forum

Thank you so much, I will try to add and see if it works.

bharat_forum

Just wanted to check, will it add this sing to all custom fields?

margarett

All the custom fields where you specifically mark as required as registration, when you create them.
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

bharat_forum

So I can choose them myself, that's really good, hopefully I will not get any errors. Thanks again for your help.

bharat_forum

I tried to add the code you posted here and got this error

Parse error: syntax error, unexpected $end in .../Themes/default/Register.template.php on line 745

736:             </div>
737:          </div>
738:          <span class="botslice"><span></span></span>
739:          <input type="hidden" name="sa" value="reservednames" />
740:          <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
741:       </form>
742:       <br class="clear" />';

margarett

Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

bharat_forum

Which file? Register.template? Can I copy and paste the whole template here?

margarett

Yes, that one.
Just attach it, don't paste it or we'll have a big post here :)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

bharat_forum


margarett

Your file is all messed up :( I assume you used cPanel editor in it.
Don't do that. Just navigate to the field and download it.
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

bharat_forum

What do you mean? Why it is messed up? I didn't change anything and removed this code. I didn't really understand how should I do it, can you please explain? Or maybe you can attach the right file so that I can copy it?

margarett

No, that's not what I mean. Your file is probably fine or else your site wouldn't work :P

What you did was to open the file in cPanel's editor and save the file from there, which resulted in a .htm file.

Just navigate to the file with your File Manager, right-click it and there should be an option to download it. Do that, you will get the correct .php file. Attach that file here ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

bharat_forum


margarett

Try this. Tested it here and it works (considering you did the changes in the other files also ;) )
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

bharat_forum

Yes, it worked, what was wrong with the file? Thanks a lot for your help.

margarett

The changes weren't there, actually or, at least, I didn't see them.
Nevermind that, glad it's fixed. I'm marking this as solved and moving it to Coding.
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

kat


margarett

Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Advertisement: