Thank you very much"> problem with default value in a field - Forums

Forums

problem with default value in a field

jaem15 15 Feb, 2011
Hello everybody ... i have a little problem ...

If i use this code in my form, everything runs ok, but field is not considerated saving record. What is the problem? I can't get it. its possible to give a default value, isn't it?

$usuario =& JFactory::getUser();
$email = $usuario->get ('email');
<input class="cf_inputbox required validate-email" maxlength="150" size="30" title="It must be a valid email" id="text_12" name="correo" value=<?php echo $email;?> type="text" />


Thank you very much
GreyHead 16 Feb, 2011
Hi Jaem15,

You are missing the <?php . . . ?> tags around the first two lines (and quotes around the email value). Here's my version:
<?php
$usuario =& JFactory::getUser();
?>
<input class="cf_inputbox required validate-email" maxlength="150" size="30" title="It must be a valid email" id="text_12" name="correo" value="<?php echo $usuario->email; ?>" type="text" />

Bob
jaem15 16 Feb, 2011
Yes, i hace the first line between php tags, I forgot because it is in another place and i made a copy paste. It run because i see the defaulta value in the field ... but the prorgram when i save the form not considerate the field, value not saved to database. It dissapear from "form field names" in "autogenerated code". If i leave value "", it comes back. I cant understand. I modified value with your proposal, because and the same problem.
<?php
$usuario =& JFactory::getUser();
$id = $usuario->id;
$nombreUsuario = $usuario->get ('username');
$nombreCompleto = $usuario->get ('name');
$email = $usuario->get ('email');
...
?>
...
<input name="email" id="emaili" size="40" class="cf_inputbox required validate-email" maxlength="100"  title="Introduzca email válido. Campo obligatorio." value="<?php echo $usuario->email; ?>" type="text" style="color: #0000FF"></td>
GreyHead 16 Feb, 2011
Hi jaem15,

Turn DeBug on to see what is being submitted from the form.

Bob
jaem15 16 Feb, 2011
In debug mode everything seems to be ok. I said it to you before. Submit send parameters, to email (the values is displayed in email body) and is sent to the destination included in the field, and everything runs ok except the save data. It doesnt save the email value. I can see that when i put a default value, like above, the "email" field doesnt appear in the "Form Fields names" in "Autogenerated COde" tab. If i delete the default value it appears again and the value is recorded with the rest of data in the table. ¿? Please ...
GreyHead 16 Feb, 2011
Hi jaem15,

By all means email or PM me the site URL and a SuperAdmin login and I'll take a quick look.

Bob
jaem15 16 Feb, 2011
Oh, sorry, now it seems work perfectly. Some little sintax problema or something like that. I dont understand ... computers sometimes become us crazy.

Im so sorry it wasnt my intention waste your time.

Thank you very much
Luis Llano
GreyHead 16 Feb, 2011
Hi Luis,

No problem :-)

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