Bienvenido, Invitado
Recordarme

TEMA:

Init Script - Element Values are Null 7 meses 2 semanas antes #255508

  • Autor del tema
  • davidtilton
  • Fuera de línea
  • Fresh Breezer
  • Fresh Breezer
  • Mensajes: 17
  • Gracias recibidas: 0
Thank you so much, this is exactly what I needed. The value is added to the field before the init script runs so everything works now. I appreciate all the help!

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

Init Script - Element Values are Null 7 meses 2 semanas antes #255514

  • Autor del tema
  • davidtilton
  • Fuera de línea
  • Fresh Breezer
  • Fresh Breezer
  • Mensajes: 17
  • Gracias recibidas: 0
Hi, I have one more question. It seems that the php query that you offered does not return the element value for the specific user that is logged in, so I am getting a value back that isn't correct.

Is there a way to query for it in a way like "select <element_name> from <record_table> where username = <username>" ?

Thanks.

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

Init Script - Element Values are Null 7 meses 2 semanas antes #255516

  • Autor del tema
  • davidtilton
  • Fuera de línea
  • Fresh Breezer
  • Fresh Breezer
  • Mensajes: 17
  • Gracias recibidas: 0
I should add that I already have the username stored as an element in the form.

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

Init Script - Element Values are Null 7 meses 2 semanas antes #255528

  • Avatar de tihana.krivic
  • tihana.krivic
  • Fuera de línea
  • Moderator
  • Moderator
  • Mensajes: 7381
  • Karma: 3
  • Gracias recibidas: 529
Hi,

something like this:
$this->execPieceByName('ff_InitLib'); //Include BreezingForms Library
$db = JFactory::getDBO();//Get Database Object
$user = &JFactory::getUser();//Get user Object

$db->setQuery('SELECT value FROM #__facileforms_subrecords WHERE name="elementname" AND username='.$user->username);

$result = $db->loadResult(); //load the result from the query
ff_setValue('ElementName', $result); // populate the value in the form. Change ElementName to the real name of your element

Hope this helps

Regards,
Tihana

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

Última Edición: Post by tihana.krivic.

Init Script - Element Values are Null 7 meses 1 semana antes #255594

  • Autor del tema
  • davidtilton
  • Fuera de línea
  • Fresh Breezer
  • Fresh Breezer
  • Mensajes: 17
  • Gracias recibidas: 0
Hi,

This approach does not seem to work and based on how the records are stored in the database I wouldn't expect it to work. It doesn't seem possible to add multiple criteria to the where clause in this case but please clarify if I missed something.

I found this old entry that describes searching through records for specific criteria: crosstec.org/en/forums/3-breezingforms-f...records.html?start=0

I want to be clear because what is described in the thread linked above seems overly complicated for what I'm trying to accomplish.

To summarize, I have users entering information in the multiple-page form. Each time a page is completed, there is an element in that page that gets set to "Complete". When the user logs in next time and the form loads, I want the form to check the last page that was set to "Complete" and navigate to that page.

So far, attempting to get the value of the "Complete" element in the form init script failed because the value is empty during the init process and only populates after the script is complete. In the past I could access the value of the "Complete" element during the init script and this is how I was doing it (I don't know why it no longer works). Is there an easy way to do this that I'm missing?

Thanks.

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

Init Script - Element Values are Null 7 meses 1 semana antes #255602

  • Avatar de tihana.krivic
  • tihana.krivic
  • Fuera de línea
  • Moderator
  • Moderator
  • Mensajes: 7381
  • Karma: 3
  • Gracias recibidas: 529
Hi,

basically, you can add multiple criteria to WHERE with AND.

Maybe I make a mistake with the code, please try it like this:
Please try it like this:
$this->execPieceByName('ff_InitLib'); //Include BreezingForms Library
$db = JFactory::getDBO();//Get Database Object
$user = &JFactory::getUser();//Get user Object

$db->setQuery('SELECT value FROM #__facileforms_subrecords WHERE name="elementname" AND username= "$user->username" ');

$result = $db->loadResult(); //load the result from the query
ff_setValue('ElementName', $result); // populate the value in the form. Change ElementName to the real name of your element

If this won't work, then please check this:
crosstec.org/en/forums/3-breezingforms-f....html?start=0#128489

Hope this helps

Regards,
Tihana

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

  • Página:
  • 1
  • 2
  • 3
Tiempo de carga de la página: 0.055 segundos