Topic: eForm + phx, pre-populate values  (Read 842 times)

Pages: [1]   Go Down

#1: 5-Apr-2009, 10:57 PM

paulkoan
Posts: 57

WWW
Hello,

I have been experimenting with using phx to pre-populate the value= fields in eforms.

Just adding phx modifiers to the eform templates didn't work unsurprisingly:

<input type="text" value="[+phx:firstname+]" name="first name"/>

The value field ends up empty (the phx:firstname modifier is a custom snippet to get the persons name)

So I decided I would try running the phx parser against the template using eFormOnBeforeFormParse=`eFormPhx`:

Code:
function eFormPhx( &$fields, &$templates )
{
   if(class_exists('PHxParser'))
  {
     $phxParser = new PHxParser();

      global $modx;
     $modx->logEvent("Eformphx",1,var_export($templates['tpl'],TRUE),"PreParse");


      $templates['tpl'] = $phxParser->Parse($templates['tpl'] );   
     $modx->logEvent("Eformphx",1,var_export($templates['tpl'],TRUE),"PostParse");

  }

  return '';
};

I can see from the event log that the value fields are correctly populated.  However, when the form is rendered, the value fields are empty.

Presumably eform is wiping the values because it doesn't expect to see them populated.  Any ideas how I can do this?

Ultimately, what I am trying to do is pre-populate an eForm with normal user attributes and extended attributes from WebLoginPE.

Thanks,

Paul



#2: 6-Apr-2009, 12:57 AM


mrhaw
Posts: 1,839

modx == freedom

WWW
See this: http://modxcms.com/forums/index.php/topic,27552.0.html
My playground: http://4up2date.info | Twitter: mrhaw
---> Check out: ReadSpeaker webReader Plugin | Support/Comments Thread
--=[ MR. HAW ]=--

#3: 6-Apr-2009, 01:03 AM

paulkoan
Posts: 57

WWW
Yeah I had already read that thread, and the others like it.

That refers to the eform snippet call itself being broken by phx, which isn't related as far as I can see to what I want to do, which is use phx to pre-populate fields in an eform template.

#4: 6-Apr-2009, 01:16 AM


mrhaw
Posts: 1,839

modx == freedom

WWW
Yes sorry! Can't find a thread I know where using a session snippet. Found this though: http://modxcms.com/forums/index.php/topic,7521.msg57209.html#msg57209 [edit]
« Last Edit: 6-Apr-2009, 01:20 AM by mrhaw »
My playground: http://4up2date.info | Twitter: mrhaw
---> Check out: ReadSpeaker webReader Plugin | Support/Comments Thread
--=[ MR. HAW ]=--

#5: 29-May-2009, 06:56 PM

eveningsky
Posts: 1

I had this problem without PHx.  Solved it by upgrading to eForm 1.4.4.6 in the repository.
Pages: [1]   Go Up
0 Members and 1 Guest are viewing this topic.