close ad
WARNING PC USERS: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

datepicker: how to set mindate and maxdate from mysql?

Thread began 11/18/2016 5:14 am by anonymous | Last modified 11/25/2016 6:27 pm by Ray Borduin | 717 views | 13 replies |

anonymous

datepicker: how to set mindate and maxdate from mysql?

Hi all,
I have a form with a select and a text input field (datepicker).
The select is populated from a mysql db.
Based on selection, I should create a recordset; the resulting recordset will contain a mindate and a maxdate in mysql format.
In the same form I have an input filed set as datepicker.
I would like the datepicker to show only the days between the mindate and the maxdate.
How can I do this?

TIA

tony

Sign in to reply to this post

Ray BorduinWebAssist

You can update the javascript manually and set a minDate and maxDate for the datepicker. See: http://api.jqueryui.com/datepicker/

Sign in to reply to this post

anonymous

Originally Said By: Ray Borduin
  You can update the javascript manually and set a minDate and maxDate for the datepicker. See: http://api.jqueryui.com/datepicker/  


I already set the mindate and maxdate manually, but I would like to get it dynamically, from php+mysql.
I would like the user to select an item from a dropdown menu. Based on dropdown selection a recordset will get 1 record from a database.
This record will contain min and max date.
The datepicker should read mindate and maxdate from this recordset.
I think I need to use ajax but I'm a newbie about it, since the recordset will be executed only after the form will post.
But I can't find a way to do this.
Any suggestion?
TIA
Tony

Sign in to reply to this post

Ray BorduinWebAssist

You can add a recordset to the page to get the mindate and maxdate and then use the bindings panel to set the value on the page from the recordset in place of the manual code you have already added.

Sign in to reply to this post

anonymous

Originally Said By: Ray Borduin
  You can add a recordset to the page to get the mindate and maxdate and then use the bindings panel to set the value on the page from the recordset in place of the manual code you have already added.  


I already tried this, but keep in mind that this should occur on the same page without reloading it.
How can I get the selected value after selecting an item from a dropdown menu populated by a recordset and use it on the same page without reloading?
Do this need ajax in any way?
TIA

tony

Sign in to reply to this post

anonymous

Just to make things simpler I decided to not set valid dates in datepicker and leave the user the ability to choose any date.
But now I would like to validate the date inserted against the values that are generated from a recordset . This recordset filters a table based on the selection made on a dropdown menu on the same page and gets 1 record with the mindate and maxdate fields (along other fields).

But it seems that this doesn't work.

Tony

Sign in to reply to this post

anonymous

ok, I'm near to the solution.
It didn't workbefore because the WA validation code was above the recordset code.
Now I moved the recordset code below the WA validation code and now it works.
The only thing that I would like to make it work is to display MINDATE and MAXDATE in the validation error message.
I simply put the binding from the recordset in the error message, but it displays empty).

Tony

Sign in to reply to this post

Ray BorduinWebAssist

That should work. If you give me a copy of the page I could look at what is wrong.

Sign in to reply to this post

anonymous

Hi Ray,
I replied with a private message.
Tony

Sign in to reply to this post

Ray BorduinWebAssist

The issue is that you are filtering the recordset based on the posted value and failing validation removes the posted value.

The solution is to set the default value to the persisted form value on line 98 like:

php:
$colname_rs_validata = WA_getSavedFormValue("persist_data","tipo_punto_vendita_reg")?WA_getSavedFormValue("persist_data","tipo_punto_vendita_reg"):"-1";


That should allow you to drag from bindings.

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...