formfields.com Forum Index formfields.com
FORMfields Forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

What is the correct code format for getParameters()?

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    formfields.com Forum Index -> FF 2.X - Frequently Asked Questions (FAQs)
View previous topic :: View next topic  
Author Message
getresults



Joined: 12 Oct 2005
Posts: 16

PostPosted: Tue Dec 13, 2005 10:02 am    Post subject: What is the correct code format for getParameters()? Reply with quote

I'm somewhat confused.

The FORMfields library is obviously improving and along with it the way the form processing in SECTION 1 is structured.

However I can't determine which is the correct code format I should be using when processing forms as the examples published in the FAQ, tutorials and form differ considerably. i.e.:

Code:

   if (array_key_exists("clear", $formBean->formFields) && $formBean->getValue("clear")) {
      $formBean->clearAllData();

and...
Code:

   if ($formBean->formFields["clear"] && $formBean->getValue("clear")) {
      $formBean->clearAllData();

and...
Code:

   } else if ($formBean->getValue("clear")) {
      $formBean->clearAllData();


Are all of these methods 100% interchangable, or is there a particular format we should always use with V2 of the FORMfields library? Will this match the code generated by the upcoming FORMgen update?

Is there a different format required by users using the V1.1 vs V2 FORMfields libraries?

Should there be a function that checks that we have the correct version of FORMfields installed (i.e.: checks the version of the FORMfields library installed on the server and indicates the required upgrade)?

I hope all these questions make sense - it's been a very long day. Smile

Thank you!
Back to top
View user's profile Send private message
formfields



Joined: 01 Aug 2005
Posts: 465

PostPosted: Wed Dec 14, 2005 5:43 pm    Post subject: Reply with quote

Thank you for your questions.

In
Code:

  if (array_key_exists("clear", $formBean->formFields) && $formBean->getValue("clear")) {
      $formBean->clearAllData();

the array_key_exists function is inserted by FORMgen, because if you decide to remove the clear button, $formBean->getValue("clear") will cause an error.

In terms of compatibility, FORMgen is only concerned with a form's structure (the addField calls) so it doesn't matter which of the 3 styles you use. For simplicity, we recommend a style like:
Code:

if ($formBean->getValue("clear"))
      $formBean->clearAllData();
Back to top
View user's profile Send private message
Guest






PostPosted: Wed Dec 14, 2005 8:19 pm    Post subject: Reply with quote

formfields wrote:

In terms of compatibility, FORMgen is only concerned with a form's structure (the addField calls) so it doesn't matter which of the 3 styles you use. For simplicity, we recommend a style like:
Code:

if ($formBean->getValue("clear"))
      $formBean->clearAllData();


Thank you for the answer - it was exactly what I was looking for. Smile
Back to top
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    formfields.com Forum Index -> FF 2.X - Frequently Asked Questions (FAQs) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group