Trying to open two form at the same time

117 views
Skip to first unread message

Zeki Çelikbaş

unread,
Dec 7, 2015, 3:37:52 PM12/7/15
to php-form-bu...@googlegroups.com
Hello Again,

I'm trying to open two pfbc form from database as shown below:

$pages = $db->get_results("SELECT id, title, page FROM Pages WHERE id_Faculty = 1 ORDER BY `order`");
        foreach ( $pages as $page ) {
            $attributes = $values = [];
            $values['page'] = $page->page;
            $values['id'] = $page->id;
            $attributes['action'] = BASE_URL . "frontpage/pageUpdate/$user->id";
            $attributes['view'] = "Vertical";
            Form::open ("pageUpdate", $values, $attributes);
            Form::Hidden("id", "id");
            Form::Hidden("panel", "pane3");
            Form::TinyMCE("Sayfa", "page");
            Form::close(false);
            echo '<hr />';
        }

But only one of them seems to be correct. Another is only showing core html of page as shown below:

Inline image 1

do you have any idea?

Thank you

zeki


Michel Côté

unread,
Dec 8, 2015, 5:02:27 AM12/8/15
to php-bootstrap-form

Hello Zeki,

Have you tried giving both forms a different name?  Right now as I see it both are named "pageUpdate".


Alexander Butenko

unread,
Dec 8, 2015, 10:01:48 AM12/8/15
to php-form-bu...@googlegroups.com
Hello,

1. Please update from master. I just fixed this problem.
2. Each Form::open() should have unique id. ex             Form::open ("pageUpdate" . $page->id, $values, $attributes);

Thank you,
Alex

--
You received this message because you are subscribed to the Google Groups "php-bootstrap-form" group.
To unsubscribe from this group and stop receiving emails from it, send an email to php-form-builder-...@googlegroups.com.
To post to this group, send email to php-form-bu...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Alex

Zeki Çelikbaş

unread,
Dec 8, 2015, 10:09:54 AM12/8/15
to php-form-bu...@googlegroups.com
Hello Alexander and Michel,

Yes I gave different names to each forms similar you typed like; "pageUpdate_$page->id". But I'll try again after update the library.

Thank you for this great library.

zeki

Michel Côté

unread,
Dec 9, 2015, 4:54:41 AM12/9/15
to php-bootstrap-form

Hi Zeki,

So how did it go?

Looking forward to seeing your reply, I've not had to create separate forms on the same page as of yet you never know what my employer will ask. :)

Alexander Butenko

unread,
Dec 9, 2015, 8:01:16 AM12/9/15
to php-form-bu...@googlegroups.com
Multiple forms were always working. Zeki issue were that multiple tinymce elements were unable to initialize properly because of the same form id and same element id.
I have commited a fix that different forms with different ids can have tinymce elements with the same id.

--
You received this message because you are subscribed to the Google Groups "php-bootstrap-form" group.
To unsubscribe from this group and stop receiving emails from it, send an email to php-form-builder-...@googlegroups.com.
To post to this group, send email to php-form-bu...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Alex

Zeki Çelikbaş

unread,
Dec 14, 2015, 10:07:42 AM12/14/15
to php-form-bu...@googlegroups.com
Hi Michel,

For a short time I went to another project because of a security hole :-( Anyway, Yes as you guess it didn't work. I think problem is at javascript. Here is my screenshot:
Inline image 2

textarea data is comming proper place and the css for height is working properly but you could not extend as shown in red circle. I decided to edit one page each time with drop down menu like this:


        $pages = $db->get_results("SELECT id, title, page FROM Pages WHERE id_Faculty = 1 ORDER BY `order`");
        $options = [];

        foreach ( $pages as $page ) {
            $options[$page->id] = $page->title;
            if (isset($_POST['editPage'])){
                $values['editPage'] = $page->id;

                $values['page'] = $page->page;               
            }
        }

Thank you.

zeki




--

Alexander Butenko

unread,
Dec 14, 2015, 10:22:47 AM12/14/15
to php-form-bu...@googlegroups.com
Indeed, I also noticed this issue. As appeared tinymce requires some tricky way to initialize multiple instances of tinymce elements on one page.

Feel free to send a pull request with a fix or wait some time till i will work it out. Meanwhile to workaround this issue you can use Form::ckeditor().
I just pushed a fix for it into master
--
Alex
Reply all
Reply to author
Forward
0 new messages