textbox autosuggest in asp vb - vbscript

The application is written in ASP VB classic and various Java scripts. I am faced with some issues
1) When I select an entry in a dropdown box, I can use the "onBlur" method to do what is needed at that point
What is the method available for an AutoSuggest Textbox that I can employ once
a) The desired entry is selected from the list (such as "onSelect").
b) The user never selects, but actually types the entire selection manually. In that case, I would need a method such as "onBeingDoneTyping"
2) When a regular dropdown is defined, I can display a user friendly description (like first and last name). In the meantime, internally I can retrieve what the index of that record is with the first entry of the parameter "value", in my case: PatientID.
" " " <%=lsSelected%> ><%=PatientName%>
How can that be accomplished when using the AutoSuggest feature in a textBox?
Say I allow "First-Name Last-Name"
Is there a hidden parameter that can be used that would let me know the index of the selected entry?
In addition, should I create a column in the data base "FirstLastName" to speed up the search?

For (1) you're after an auto-complete function. I've used this jQuery with classic-ASP a few times (excellent little plugin): http://docs.jquery.com/Plugins/Autocomplete - there's a good demo and example source there.
For (2) - assuming that you're using the jQuery plugin, then your object is a textbox, not a select object. So if the textbox you created is:
<input type="text" name="example" id="example" />
when the form is submitted any request.form("example") will return the text entered, not the index/selected value from any list of options.

Related

How to extract dynamic drop-down forms with iMacros?

I am looking to fill out a dynamic dropdown form with iMacros. With a regular form, I am able to loop using VBS successfully and able to extract information based on how I fill out the dropdown form.
However, there is one website that I'm trying to extract from where the option values in field 2 completely changes based on what you select in field 1. (i.e. "<option value="">" changes).
I am having trouble looping this, since the iMacro function doesn't work when you use #, $ or % for the CONTENT attribute. (I have tried them all).

Which dojo widget should be used for DropDown

I wish to create dynamic dropdown, meaning the value of the second dropdown changes with the change in selection on the first. I was looking through the Dojo docs and it seems there are 3 different widgets that I can use,
dijit/form/ComboBox
dojox/form/DropDownSelect
dijit.form.Select
Now I am confused as to which one should i use for creating Dynamic DropDowns?
You can choose anyone depending upon what extra features you want. While dijit.form.Select is your normal HTML select, combobox and filteringselect offer more features.
Follow http://kennethfranqueiro.com/2010/06/combobox-vs-filteringselect/ for a comparison between the two. You can also play with them to know how they work.
I had used FilteringSelect in my app for the same behavior as need.
Differences between dojo dropdown :
Select It is simple combobox like select in HTML with no validation
and not provide any search facility inside select options.
ComboBox It is pure form of combobox and name as ComboBox again it
will not provide any default validation but it provide search
facility within its options.
FilteringSelect It is an advance form of select have default
facility of validation and search facility. And it also has property
to take value as input tag take value in HTML.
In dojo you can also try custom validation which is provided inside dojox library. I hope it will help you.

ValidationGroup easy explanation

Can someone help me with this line of code and tell me what it is looking for? This chunk of code is associated with a text box control on my page.
ValidationGroup="<%# ((TSAPassenger)((RepeaterItem) Container.Parent.Parent).DataItem).PaxKey %>" runat="server" ErrorMessage="Invalid Contact Name.">
When a postback occurs (via a button press, autopostback dropdown list, etc), ASP.NET will validate all inputs for the validation group specified on the control that caused the postback.
That line of code is grabbing the 'PaxKey' property of the data item for the repeater item two levels up in the control tree that contains the text box and using it to specify the validation group the textbox belongs to. This is likely there to limit the validation to just the fields for the record you're updating (as opposed to everything on the page).

FoxPro sum form fields

Using autogenerated form from a single database table. The form uses the class WizBtns included in c:\Program Files\Microsoft Visual FoxPro 9\Wizards. The form has Top, Previous, Next and Bottom buttons.
Although the form only has textboxes to enter data for the fields in the table, I have added a custom Text Box from the toolbox which basically intends to display the sum of some fields. I have bound the ControlSource of the text box to a PUBLIC variable costTotal that is created on the form init.
Now the problem is updating the sum of fields in the text box, or simply updating value of costTotal. Where to add the code for this? Adding the code in the form's Refresh method mixes up the value of costTotal, when I press Next button to update all fields with new values, the custom text box displays the sum of the last record which is mysterious.
I would add a method to the form to do the calculation. Then, call that method from the Valid method of each of the textboxes involved in the calculation.
There is nothing wrong with using the refresh event to recalculate the values, just make sure that you call the refresh each time the record changes
If you are using navigation buttons to move between records then the click event of EACH button is an ideal place to issue the refresh request :-
Assuming the textbox is called txtSum and is located on the same form as the navigation buttons then in each buttons click event add this code
dodefualt()
with thisform
.txtSum.refresh()
endwith
Couple of things:
1) do not use the wizards! Make your own base classes. Trying to figure out what the wizard classes do and how to add functionality will take more time that coding your own base classes. Also, the wizard generated code and classes must be at around 10/20 years old, much has changed since then (a polite way to say they suck).
2) Do not EVER use public variables in FoxPro, except for maybe an app object.
If this is a one shot thing, just add default textboxes and buttons and design the form yourself. You will have total control and you will know what each thing does.

ASP.NET MVC Multiple Sequential Posts - Data Not Populating

I have a fairly complex form on my ASP.NET MVC Page. It works like this...
On default load (no HTTP post), it has two select boxes, bound to the Model, and a submit button.
On submit (HTTP post), the values in the select boxes are used to pull some data from the DB. That data is then added to the model instance that was posted, and the instance is used to issue another View(myModelInstance) call.
At this point, things look good. My select boxes retained the selected values, and the new elements based on the DB data are displaying.
If I do another post now, whether I change data or not, the original values selected in the select boxes are null within the Action method of my controller, but the values for the DB data textboxes are not.
The only thing I am really doing special here is using the index notation within Razor to be able to edit parts of my Model that are within an IEnumerable...as in the following example...
#for (int i = 0; i < ViewBag.SomeArbitraryNumber; i++)
{
<input type="text" name="myModel.MyEnumerable[#i].MyValue"
value="#(Model.MyEnumerable[i].MyValue)" size="2" />
}
This indexed notation usage only happens after the original select box values have been posted.
UPDATE:
It seems that the major contributor here is the special index notation. If I eliminate it, it works fine. Also, if I include additional hidden fields to match the two select boxes, and also use the indexed notation for those, the second post works.
Is it possible that your browser is caching the original select boxes, and they were never populated by your second view? In MVC you have to populate the select boxes every time they are displayed. In Webforms, viewstate does this for you automagically, but in MVC it is up to you to make sure they are populated.

Resources