Jump to content


Photo

Can't access form field from previous page


  • Please log in to reply
3 replies to this topic

#1 paulgami

paulgami
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 23 August 2006 - 02:36 PM

I've built a multipage form using QuickForm_Controller.  It has 5 pages, plus a final confirmation page, not too dissimilar to a shopping cart's checkout functionality.

If I'm on page3 and want to reference a particular field on that page in javascript I use:
page3.fieldname.value
and it works just fine.

Is it possible to reference fields on other pages?  When I try to reference an item on page2 from page3, for example, I get this error:

Error: page2 is not defined
Source File: http://testbox/formtest.php?_qf_page3_display=true
Line: 1


#2 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 23 August 2006 - 02:46 PM

Is it possible to reference fields on other pages?


No. You'll need to pass this data from one page to the next.

#3 paulgami

paulgami
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 23 August 2006 - 03:13 PM

It's already getting passed along to the final page though.

Currently my last page consists of..
$values = $page->controller->exportValues();
var_dump($values);

.. which outputs all the fields from all pages.  Can I not somehow access that data before the exportValues() call?  ???

#4 SammyP

SammyP
  • Members
  • PipPipPip
  • Advanced Member
  • 58 posts
  • LocationLondon

Posted 23 August 2006 - 03:21 PM

Why can't you just use the exportValues() call on p3?

Fair chance it will still be available on p5.

If this has solved your problem, a quick 'Thanks' is appreciated, but marking the thread as 'Solved' is better - it saves a lot of time.

Sam.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users