Jump to content
  • 0

Cascading form with the parent box as a text field.


Question

I understand how I can use the cascading dropdown to auto populate fields based on the parent drop down. Here is my dilemma.

I want to allow the user to use their assigned permit ID number to populate the remaining fields. (year make model and color of the car) if it exists in the permit database. I do not want to use a dropdown as I do not want to display a list of active permit numbers. How would I use a text field as the parent to populate the child boxes below? Also, how would I display an error message (maybe "This permit is not registered in the system. You must use a valid permit number to proceed") if the permit does not exist in the permit table?

Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

You can create one text field, one dropdown field(parent), and one cascading dropdown(child). Hide the dropdown. Create a button, when user click the button, it will pass the value from text field to dropdown. Then it seems the cascading is from text field.

1. code for button, insert into a HTML Block:

<button type="button" id="Pass" onclick="myFunction()">Cascading</button>

2. function of passing the value from text field (id:cbParamVirtual1) to dropdown(id:cbParamVirtual2), please change the field id to the appropriate field name. Insert into Footer:

<script type="text/javascript">
var select_drop = document.getElementsByName("cbParamVirtual2")[0];

function myFunction()
{
select_drop.value = document.getElementById("cbParamVirtual1").value;
select_drop.onchange();

if (select_drop.value !== document.getElementById("cbParamVirtual1").value)
alert("This permit is not registered in the system. You must use a valid permit number to proceed!");
}
</script>

3. Hide dropdown field: http://howto.caspio.com/customization/hide-fields-in-datapages.html

<table style="display:none;">
</table>
Link to post
Share on other sites
  • 0

Ok, I've tried this all the ways I know how and it just doesn't work. One of the things I noticed is when you try and hide the dropdown box, the box disappears, the virtual1 folder is renamed to virtual 2 (then there is 2) and the entire thing just explodes.

I am sure I'm doing something wrong. I am working with a view because I need to access 2 tables. I am having a lot of trouble understanding that concept and I can't seem to get any help (I can only work on my project in the evening and cannot avail myself of caspio's staff during the day.)

I have two tables.

the first table (dpmc_permits) contains all the permanent vehicle, owner, and assigned permit information. The second table is called (dpmc_changes) and it only contains the temporary vehicle information. The idea being they can change their permanent car with a temporary one for a set amount of time.

It is a difficult concept for me to grasp. In this particular parking garage, there is absolutely no guest parking. Having said that, Residents are allowed to let their friends use their parking space as long as their car is removed while the temporary car is there. (thereby not consuming any extra spaces).

It is also entirely possible I'm making this too difficult and I should just use one table for all this information. Here is a basic stepped outline of what I'm trying to accomplish. (I know somebody here's gonna go "Why doesn't he just blah blah, then blah" and make me look like an idiot but I'm ok with that. Once you do that, then I'll give you my tow truck and tell you to upright the loaded fuel tanker that's laying on it's side in a snow storm while the rest of us watch, LOL).

1.) Permanent car is registered into garage and assigned a permit. Permit is activated.

2.) Resident gets in accident and car goes to shop. Resident is given a loaner car.

3.) Resident then goes online to register a 'temp vehicle change' on the DPMC website.

4.) Resident logs into their user account then selects temp change form.

5.) Website uses permit ID to confirm permit details (Active, Inactive, Denied, etc) then auto populates first part of form with users details (name, Car info, plate, etc). User may have more than 1 vehicle/permit.

6.) Once the permit ID is confirmed and the permit status is confirmed (Active), the user is allowed to complete the temp change form.

7.) The information is posted to the DB and becomes available to the agents in the garage.

8.) When agent goes through garage, he finds car without a permit.

9.) He then checks that car against the DPMC database by searching the license plate.

10.) Search reveals that vehicle has been registered as a temp vehicle.

11.) Agent then checks to see if original car is also in garage. If both cars are in the garage, the permanent vehicle is impounded and removed. If not, no violation and all is well....

The reason I think I need a second table is to record all the changes. Some of these people do this several times a week and I want to keep all that data for future reporting use. (Watch for abuse, etc) I don't really want to muddy the permit DB with all this extra info. (maybe hundreds of 'changes' assigned to one user over a period of time).

If I can get this done, I'm home free and can finish my project. Thanks to everyone ahead of time.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...