PDA

View Full Version : Prefilled Custom Profile Field???


leon2u
08-26-2002, 07:00 PM
Hai there,

I made an custom profile field which users need to fill out with a serialnumber. This is a required field!!

All serials are starting with '700-' and need to be prefilled in the required Serial textbox field. So that users directly can enter the rest of their serial behin the '-' sign.

How can I do this???

Thanx for your effort already!

g-force2k2
08-26-2002, 09:10 PM
just when you create the profilefield then give it a default value... but if you really want the serialnumber to be exact then you should use conentation(sp) and connect a variable that equals 700- ie:

in member.php

$snumber = "700-";

but its better off creating your own field because it would be tough to alter the updating of one profilefield...

then you should also maybe use expressions depending upon how close you want the number match to be... regards...

g-force2k2

Logician
08-27-2002, 07:06 AM
After you took g-force's advice, this hack (https://vborg.vbsupport.ru/showthread.php?s=&threadid=35118) can help you to force your users enter numeric data for your field..

g-force2k2
08-27-2002, 02:19 PM
lol... i didn't know you made such a hack Logician looks good though :)

regards...

g-force2k2

leon2u
08-27-2002, 02:42 PM
to fill out the code for this in member.php?

And where can i fill out a default value for a custom field?

thanx

g-force2k2
08-27-2002, 02:48 PM
well you can edit the field value in phpmyadmin and add a default value of 700- if you want but i would prefer using conentation because that way the 700- part cant' be edited and will always be inserted :) regards...

g-force2k2

leon2u
08-27-2002, 02:59 PM
I cannot get it to work......sorry how do I have to do this...do i need to add a field in PHPAdmin called Value or so?

Logician
08-27-2002, 03:04 PM
Originally posted by g-force2k2
lol... i didn't know you made such a hack Logician looks good though :)

small hack..one of my firsts.. :)

All serials are starting with '700-' and need to be prefilled in the required Serial textbox field. So that users directly can enter the rest of their serial behin the '-' sign.

What about this idea? Since all serials need to start with "700-" why don't you add this info just left to form input field, instead of putting the info inside the form field.

What you are trying to do:

Serial Number : [700-.........................]

What I suggest:
Serial Number : 700-[.........................]

This will save you a lot of trouble like:
a) inserting a default value to your field
b) Checking if user sent the field with only data "700-" or entered some other numbers too
c) More easily applying numeric required hack
etc.

If you like the idea holler and I (or g-force2k2) can tell how your will do it..

leon2u
08-27-2002, 03:17 PM
Tell me how to do that, I found only this:

Template register_customfields this is where all data comes in from the customfields

Template registeradult there stands this $customfields_required
So here will come in my Serial....plz take a look @ my site
www.inventorusers.nl and go to the registerpage to see the field! See snapshot also...

Do not how to this from here....

leon2u
08-27-2002, 03:28 PM
Well fixed the hack myself........cool......see snapshot!

Quite simple indeed!

Created a custom template called register_customfields_kg and changed this code in register.php

ORG-CODE:
------------------------------------------------------------------
eval("\$customfields_required .= \"".gettemplate("register_customfields")."\";");
------------------------------------------------------------------

NEW CODE:
------------------------------------------------------------------
eval("\$customfields_required .= \"".gettemplate("register_customfields_kg")."\";");
------------------------------------------------------------------

Well the solution you can see in the snapshot!

I suppose this is what you mean?

Logician
08-27-2002, 04:11 PM
good job.. dont forget to apply your hack to member.php so that your field will be displayed correctly when someone edits his member profile (unless your field is Admin Only field)

leon2u
08-27-2002, 04:12 PM
Ever noticed that in your user profile your custom user profile fields are at the bottom, including the REQUIRED FIELDS!!

No big deal.....copy the code from your register.php to your member.php......look for the line customfield in both files to find...

Then add in this template the field $customfields_required and from now on all your required customfields are on top...

leon2u
08-28-2002, 08:13 AM
Post the result with a new question in a minute again.....

thanx