Forums | Mahara Community

Developers /
How to pass hidden variables from pieform to submit function?


anonymous profile picture
Account deleted
Posts: 31

10 November 2010, 6:06

I am developing a reading artefact by copying codes from blogs artefact.

The code utilizes the web service from an online book company to find books.

http://blog.aladin.co.kr/ttb/category/16526940?communitytype=MyPaper

After user selected the book he read, he can add an essay on the book. If he wants to save book info and essay, values from the pieform are passed to the submit function. I cannot send the book info via hidden variables while I can send the info using normal variables.

Welcome any comments.

Thanks,

Jong-Dae Park

 

anonymous profile picture
Account deleted
Posts: 214

10 November 2010, 6:31

Hi Jong-Dae Park,

You should be able to add an element to your pieform of type hidden. For example:

$elements['bookid'] - array(
    'type' => 'hidden',
    'value' => 12345,
);

Good luck!

Andrew

anonymous profile picture
Account deleted
Posts: 31

13 November 2010, 14:25

I solved the problem by sending received hidden variable as a hidden variable for next page.

What I've done is as follows,

1. copy blog plugin and rename blog->reading, blogpost->readingpost, etc.

2. add fields in install.xml file

3. add fields to readingpost class definition.

4. I copied post.php file to search.php, editreading.php.

5. Page sequences are view page -> search page ->select book page -> editreading page

6. click search button to go to search page

7. enter key word to search book. This page send keyword to select book page.

8. In select book page, display book covers with other info. If user selects a book, send isbn to editreading page.

9. In editreading page, it fetches selected book info and display it using pieform with an essay field.

10. when user click submit button, it saves all info into database and redirect to view page.

11. I have to include the received hidden variable isbn in editreading page again to solve the problem.

Thanks. 

A post by Account deleted was deleted

4 results