• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: How to record created date to database ?

How to record created date to database ? 16 years 8 months ago #4565

Hello,

My form is for regitered members only and after submit it records to database by mapping plugin. When member log in to site and submit form I record to database member id with code bellow;

I write this code when I create hidden field in Default Value.
//<code>
      $user = $RSadapter->user();
      return $user['id'];
 //</code>

I need one more code for record created date to database but I couldn't. How can I record form create date to content table in database ? Is there some code for created date like above?

Thanks.<br><br>Post edited by: joomlacup, at: 2008/09/05 14:19
The administrator has disabled public write access.

Re:How to record created date to database ? 16 years 8 months ago #4566

  • haboyes
  • haboyes's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 3
You could try:
//&lt;code&gt;
jimport('joomla.utilities.date');
$jnow=new JDate();
$now=$jnow-&gt;toMySQL;
return $now;
//&lt;/code&gt;

I have used this code as part of a 'checkout script' where I am using RSForm!Pro to prepare an update to an existing record. This code certainly works on the Script tab for RSForm!Pro. It the above script is used to create the Default value for a hidden field called \"created\" you could then map this to the relevant database field.
The administrator has disabled public write access.

Re:How to record created date to database ? 16 years 8 months ago #4568

I tried your code but there is no change it doesn't record any value to database. I use rsformPRO and joomla 1.5.6
The administrator has disabled public write access.

Re:How to record created date to database ? 16 years 7 months ago #4590

Well, I noticed that MySQL's DATE datatype is YYYY-MM-DD, so when I changed the display on RSForm to show yyyy-mm-dd, it would write to the table. But I prefer to display the date as mm-dd-yyyy for my users here in the USA.
As for using hidden field to write the date, I used the following:
//<code>
return date('o-m-d');
//</code>

So, how do we get rsforms to write the date to MySQL inspite of what format we use?
The administrator has disabled public write access.

Re:How to record created date to database ? 16 years 7 months ago #4620

Nobody knows about our questions ? Help please :(
The administrator has disabled public write access.

Re:How to record created date to database ? 16 years 7 months ago #4664

  • nettemor
  • nettemor's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 33
I also need help on this.

The date in mysql is yyyy-mm-dd

In RSformsPro i display dd.mm.yy

How can i convert dd.mm.yy using rsforms and send this to the database?

Hope anyone can help us with this.
The administrator has disabled public write access.

Re:How to record created date to database ? 16 years 7 months ago #4683

  • nettemor
  • nettemor's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 33
This seems to be a very quiet forum.

I really need help with this.

Hope that there exists somebody which are familiar with RSForms and can tell me who to solve this.

Please answer if you know how to solve this.
The administrator has disabled public write access.

Re:How to record created date to database ? 16 years 7 months ago #4684

  • dragonjc
  • dragonjc's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 151
you don't say wich dat it is. Is it calendar or submission date ?
If it is calendar, you can on script process (see knowledgebase how to do) custom the registering. Or Change it in manage forms.
If it is the submissions table and not submission values, you can't change it.
Component RS SHow Form in build
The administrator has disabled public write access.

Re:How to record created date to database ? 16 years 7 months ago #4685

  • richiep
  • richiep's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 131
As far as I know this would require a JavaScript. Unfortunately tech support won't help with this.

Anyone know how to create a hidden field and a JavaScript that would fill it with the current date?

Richiep
The administrator has disabled public write access.

Re:How to record created date to database ? 16 years 7 months ago #4686

  • nettemor
  • nettemor's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 33
It is dates which are selected from the calendar.
Display format is set to dd.mm.yy and when saving this to the database it gives a crazy date.

Therefor i need to convert the dd.mm.yy date to a format that mysql recognizes, like yyyy-mm-dd.

I have read the knowledge manual, but it does not gives me directions enough to manage this.
Honestly i need someone to give me an example how to do this. That's how we learn when things are new.

I have never used RSForms before, and i find it difficult to get started with the scripting here.
The examples in knowledgbase are so few, and does not give me enough examples for me to manage this on my own yet.

I think that when you have paied for an extention you should be able to get some starting help to get you going.
I have used Facile before, and i think that RSForms support have something to learn when it comes to help out with examples.

It is just not enough to say that i can \"script process\" and have a look at the knowledgbase how to do it.
Don't mean to be rude dragonijc, i really appreciate you trying to help me, but unfortunately the help you provide does not help me.
It is clearly to me that you know how to do this dragonijc, so i ask you to please provide an example, - that would be great help.
The administrator has disabled public write access.

Re:How to record created date to database ? 16 years 7 months ago #4687

  • dragonjc
  • dragonjc's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 151
First you have the knowledgebase. There is lot of thing in this notice.
Second Forum is not the support. If you want some support send a ticket. It's write in big at top Nettemor ;)<br><br>Post edited by: dragonjc, at: 2008/09/16 07:01
Component RS SHow Form in build
The administrator has disabled public write access.

Re:How to record created date to database ? 16 years 7 months ago #4698

  • nettemor
  • nettemor's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 33
No need to be sarkastic, i am just asking for help and expressing an opinion.

If you know where to find info about a conversion like this in the knowledgbase, will you give me a link to the correct chapter ? Cause i have searched and cant find anything that helps.
The administrator has disabled public write access.

Re:How to record created date to database ? 16 years 7 months ago #4699

  • dragonjc
  • dragonjc's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 151
Calendar

As the name implies, this is a very customizable calendar used for date/time collection. The properties that this component supports are

* Name: the name of the component. Please remember that this property must a have a non-empty and unique value within a form.
* Caption: the caption associated with this component.
* Required: this property specifies that the current component must have a value, otherwise the form will not be submitted. In other words, the user must submit a date in the component.
* DateFormat: this property describes how the date will be shown to the user in the front-end part. Please use the folowing table to determine your desired date format.

Mask Description
d Day of the month as digits; no leading zero for single-digit days
dd Day of the month as digits; leading zero for single-digit days.
ddd Day of the week as a three-letter abbreviation.
dddd Day of the week as its full name.
m Month as digits; no leading zero for single-digit months.
mm Month as digits; leading zero for single-digit months.
mmm Month as a three-letter abbreviation.
mmmm Month as its full name.
yy Year as last two digits; leading zero for years less than 10.
yyyy Year represented by four digits.
* CalendarLayout: specifies how the calendar should be shown in the front-end. Possible option are
o Flat: the calendar is displayed directly (i.e. no action is required to show the calendar).
o Popup: to display the calendar, the user must push a button and the calendar is displayed.
* AdditionalAttributes(!): using this property you can set custom attributes inside the HTML tag.
* ReadOnly: applicable only for a popup calendar. This option alows the user to edit manually the text box where the date is displayed.
* PopupLabel: applicable only for a popup calendar. Sets the text on the button that when pressed, shows the calendar.
* Description: the description of the component. This will be displayed in the front end, as a textual help for the user. Use this when the Caption of the component is not self-explanatory.
* ValidationMessage: shown when the Required constraint is not met. In other words, if the user doesn't choose date, this message will be displayed and the form will not be submitted.

www.rsjoomla.com/index.php/rsformpro.com...lendar/Calendar.html
Component RS SHow Form in build
The administrator has disabled public write access.

Re:How to record created date to database ? 16 years 7 months ago #4702

  • nettemor
  • nettemor's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 33
This i have read, but as i stated before, this does not say anything around the topic conversion.
The administrator has disabled public write access.

Re:How to record created date to database ? 16 years 7 months ago #4705

  • dragonjc
  • dragonjc's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 151
can you load picture of what you want, because, if it is not that, i don't see what you want.
Component RS SHow Form in build
The administrator has disabled public write access.

Re:How to record created date to database ? 16 years 7 months ago #4707

Let me see if I can iterate this properly:

1. Table created in MySQL with a field name of Date_submitted with the data-type of DATE. MySQL's DATE datatype format is YYYY-MM-DD.
2. Created a RSForm Pro form with Pop-up calendar field to display as dd-mm-yy (or mm-dd-yy)
3. Created a data mapping in RSForm Pro to the MySQL table.

The problem is the RSForm mapping does not write to MySQL's format of YYYY-MM-DD, so nothing is written to the table.
The administrator has disabled public write access.

Re:How to record created date to database ? 16 years 7 months ago #4708

  • nettemor
  • nettemor's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 33
Yes! That is a correct summary.:cheer:

Actually a date is written to the databasetable, - but the date is just crazy, it makes no sence.

So i need to convert the RSForm Pro date to a date which MySql understands. This is my problem.
The administrator has disabled public write access.

Re:How to record created date to database ? 16 years 7 months ago #4710

  • dragonjc
  • dragonjc's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 151
Don't touch to the Submissions Value with mapping. If you change it, you will not have the good information for display data in front end.

Just insert a field into Submission_values
If you add a field to have date with popup calendar, it will be write in text and not in date. So there is no differences for mysql because the format is not register as date, but as texte.<br><br>Post edited by: dragonjc, at: 2008/09/18 07:01
Component RS SHow Form in build
The administrator has disabled public write access.

Re:How to record created date to database ? 16 years 7 months ago #4715

  • nettemor
  • nettemor's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 33
Put the following code in the Script tab, on form process:

if(isset($_POST)){
$date = explode('.',$_POST);
$_POST = $date[2] . '-' . $date[1] . '-' . $date[0];
}

where Contactdate is the RSFormsPro calendar field.
This field are set to display dd.mm.yyyy and in the backend it will now be saved as YYYY-mm-dd

It works, and correcte date are saved to MySql :cheer:
The administrator has disabled public write access.

Re:How to record created date to database ? 16 years 7 months ago #4922

I am a new user to RSForms and was searching the forum for a solution to this exact issue. Thanks very much for posting the solution - it works great!
The administrator has disabled public write access.

Re:How to record created date to database ? 16 years 7 months ago #4923

OK - that solution worked for the date input field to get it formatted for storage in the MySQL database. But I am still having difficulty getting the create_date to store in the database. I am using a hidden field and the mapping pluging to associate with a date field in a MySQL table. I have tried all of the suggestions in this thread for storing the date from a hidden field that uses a default value to populate the current date. But I am not having any success getting the date to store in the database.

Were any of the above suggestions working for storing the current date as the record create date in a MySQL date field? If so, which one worked?

THX
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!