|
 paja patak - 2009-11-21 22:29:54
I'm trying to integrate your form class into my project. And this is exactly what I looking for, very good job.
Now I have small problem which I trying to figure. I'm adding date field with $form->addDate("published date:", "created");
I'm getting jquery pop up window to select date, that's fine but inside mysql table on this field is empty. When I for example add date with addTextbox everything is ok. What can be a problem ?
My table structure for date field is (DATE).
regards,
MK
 Andrew P. - 2009-11-22 20:36:40 - In reply to message 1 from paja patak
MK,
Thanks for your email and support of this project. I think the problem you're running into is the DATE MySQL field type is expecting the format of YYYY-MM-DD. The formbuilder class submits a more human readable format that looks like November 22, 2009. Before you send the data to your database table, you will need to use php's date() function to reformat what the formbuilder class submits so that MySQL is satisfied.
So if your form field name is "created", you can do something like this...
$formatted_date = date("Y-m-d", strtotime($_POST["created"]));
Please give that a try and let me know if you have any further questions.
Thanks Again,
Andrew
 paja patak - 2009-11-23 21:17:42 - In reply to message 2 from Andrew P.
thanks for advice, problem solved.
Now I have one more question :)
I'm trying to integrate tinymce latest version with fulleditor option (lightbox, etc.)
I did'nt try simply to replace tinymce dir with the latest one.
Can I add feature like this in form class file
if(!empty($ele->webeditorSimple)) $ele->attributes["class"] .= "tiny_mce_simple";
option like this
if(!empty($ele->webeditorFull))
$ele->attributes["class"] .= "tiny_mce_full";
but it seems to dificult to follow your code further to add tiny_mce_full wherever I need to.
Maybe you have solution already ?
Greetings,
Mladen
 Andrew P. - 2009-11-24 15:09:59 - In reply to message 3 from paja patak
Mladen,
You are more than welcome to make changes to the class to fit your needs. The sections within class.form.php that handle the webeditor form field are lines 1375-1419, 2161-2182, and line 2282.
The first section (1375-1419) builds the <textarea> tag with the appropriate attributes.
The second section (2161-2182) holds the javascript that scans the document for the appropriate class names to trigger the tinymce editor.
The third section (2282) simply defines the webeditorSimple attribute. If you were going to add another element attribute such as webeditorFull, you would need to add another line defining that variable.
Just to note, the latest version (3.2.7) of tinymce is included in the formbuilder class. I would be more than happy to give you better advice on making the changes, but I don't know what you're referring to when you mention the "fulleditor option". Do you have a link that I can see this functionality?
- Andrew
 paja patak - 2009-11-24 20:51:12 - In reply to message 4 from Andrew P.
I thought that this is an old version of tiny mce. I'm interested how to add this nice styled pop up windows in editor, insert image for example, like its on http://tinymce.moxiecode.com/examples/full.php
thanks for replies.
 Andrew P. - 2009-11-25 15:35:58 - In reply to message 5 from paja patak
I believe I have made the appropriate modifications to make the popup windows render as modal dialog boxes. Please check the web editor demo at http://www.imavex.com/formbuilder/examples/webeditor.php and verify that the functionality you described is included. If so, you will need to download and install the latest version of this project at http://php-form-builder-class.googlecode.com/files/formbuilder.zip.
Just a quick note, in case you didn't see on this project's main page, I moved the project's home to Google Code (http://code.google.com/p/php-form-builder-class/). I will no longer be posting updates and new features to the PHPClasses.org.
I hope you find these changes helpful in your development.
- Andrew
 paja patak - 2009-12-05 12:20:54 - In reply to message 6 from Andrew P.
sorry for delay, it's works like a charm.
Now I have one more question :)
Hopelfully you will have enough time to answer.
I'm trying to integrate selectbox with lists of admin users in it.
here is the code
$users = Users::find_all();
foreach($users as $row){
$user_id = $row->id;
$username = $row->username;
$form->addSelectbox("Autor:", "user", "", array("" => "--Izaberi opciju--", "$user_id" => "$username"), array("required" => 1, "class" => "borderClass"));
}
after this in my selection box is only one user.
In my solution where I do not have form class I'm using solution which works
like this
$users = Users::find_all();
echo "<select name=\"user\" size=\"1\">";
foreach($users as $row){
$user_id = $row->id;
$username = $row->username;
echo("<option value='$user_id'>$username</option>\n");
}
echo "</select>";
but ofcourse I need to solve this to using form class as in first example code above to render form properly.
Regards,
MK
 Andrew P. - 2009-12-05 20:59:54 - In reply to message 7 from paja patak
Here's what I would recommend.
------------------------------------------------
$users = Users::find_all();
$userArr = array();
foreach($users as $row)
$userArr[$row->$id] = $row->username;
$form->addSelectbox("Autor:", "user", "", $userArr, array("required" => 1, "class" => "borderClass"));
------------------------------------------------
You can see from the code snippet above that I am looping through the users returned by the find_all method call and building an associative array with the key being the userid and the value being the username. You can then pass that associative array in the addSelectbox method.
One thing I would note is that I released a new version of the formbuilder class last evening which is completely backwards compatible with older versions. You can download that at the project's new home at http://code.google.com/p/php-form-builder-class/. This new release includes an update to the google maps form field and is described via a YouTube video at http://www.youtube.com/watch?v=Bws_P7JlqnQ
Good luck with your development,
Andrew
 paja patak - 2009-12-05 21:51:46 - In reply to message 8 from Andrew P.
thanks for fast reply, it works.
I will check new version of form class.
regards,
MK
 paja patak - 2009-12-12 23:44:07 - In reply to message 8 from Andrew P.
Hi Andrew,
I have to ask you how can I implement choose user option on solution you recommend before on $userArray
------------------------------------------------
$users = Users::find_all();
$userArr = array();
foreach($users as $row)
$userArr[$row->$id] = $row->username;
$form->addSelectbox("Autor:", "user", "", $userArr, array("required" => 1, "class" => "borderClass"));
------------------------------------------------
This chooseUser option need to be empty, like it was in example files of this class
---------------------------------
array("" => "--Choose option--");
---------------------------------
So just to be clear :)
I need this $userArray in the addSelectbox and I need an Choose option on top of this array with empty record.
Regards,
MK
|