Jump to content


  • Content Count

  • Joined

  • Last visited

  1. I have a submission form where I have sections that are hidden based on the input of the user (if the user input is not as desired, an error message is displayed by unhiding a section). Users should not be able to submit the form when any section is showing, for this i intent to use event.preventDefault(). How can I do this in javascript? Any suggestion are welcome.
  2. Firstly, thanks for putting your time and effort in answering my question I think I did not explain my problem clear enough, so I will try again. In the app i'm making customers can book a seat for a movie or theater performance, for this I use 3 datapages. 1. A report page where customers can search for a genre, time or place. When they found their desired movie/theater performance they will go to the details page, here a hyperlink is displayed that brings them to the next datapage. Note: this is where i want the details of the movie to be saved in to the local storage. 2. This page is also a report page and calculates the number of already booked seats, I filter on an ID I passed (parameter) from the details page, then with some javascript i calculate the number of records, this is a page invisible for the end-user; and autoredirects after calculating. Note: this is de results page i referenced to in my orginal post, this value is stored in localstorage. 3. The user then ends up in the submission form where he can book a seat. Here is where I retrieve information from the localstorage. The problem occurs here, it is possible to retrieve and display the amount of booked seats but when I try to display the information about the movie it displays null. As a test I passed some other information from the results page (page 2) and this did work. U suggested I used the following script. <script type="text/javascript"> var title = localStorage.getItem('title'); if ((typeof(title) !== 'undefined') && (title !== null) { // title has already been saved in localStorage document.write(title); } else { // title has not yet been saved in localStorage // TODO: Call myFunction() here to automatically save the title variable, just in case --> myFunction(); } </script> Correct me if i'm wrong but it wouldn't be possible to execute the script from the submission form; since there is no information about the movie, right? I hope my problem is clear now, my excuses for not explaining it clearly in the first place.
  3. Thank you mathilda! Without the time and the correct format it is comparing the way I want. One problem less to worry about.
  4. The thing I'm trying to achieve is that users of my app can only plan a date after today, with "rules" I am able to display a message when a user selects a date before today with the date picker. I achieve this by hiding a section when the given date is ok (Input_date > Timestamp). But while it is not possible to prevent users from submitting the form when a condition is not met, I'm trying to find a solution in javascript. The problem that occurs is that the format differs, the inputfield of the user is DD-MM-YYYY and the timestamp i compare it with is MM/DD/YYYY. Strangely this is not a problem with "rules". The code I use: <script> function myFunction(){ var StartDate = document.getElementById("InsertRecordStartDate").value; var Today = document.getElementById("cbParamVirtual1").value; // This virtual field receives the timestamp onload if (StartDate < Today){ alert('Not all conditions are met"); event.preventDefault(); } document.getElementById("caspioform").onsubmit=myFunction; </script> How can I fix this issue? Thanks in advance.
  5. So I was exploring the functionalities of the localstorage function within javascript. I want to plass information between two webpages. When I save data from the results page and later call that information in a webform it works as desired. But, when i try to do so from a details page, it returns null everytime. I do the exact same thing in the details page as in the results page, but somehow the script does not get executed. In the footer of the details page i made a button: <script type="text/javascript"> function myFunction(){ localStorage.setItem('title','Example'); } </script> <button onclick="myFunction()">Store data</button> In the submission form I placed the following code in an html block: <script> var title = localStorage.getItem('title'); document.write(title); </script> The document write function displays null. When I save it on the results page it displays Example. Does anyone know to correctly execute the script?
  • Create New...