Getting dropdown selected value on change using DOJO script - javascript

Hi I am working on DOJO website and I need to get the dropdown selected value without redirecting to another page using DOJO script or Plain javascript(No jquery, because dojo website not supporting Jquery).
Here is my scenerio
View account
View payment
address change
FAQ

You want the value selected from a drop down box but the act of selecting the value in the first place causes a redirect? You mean the values are coded as links? If so then you need to find the code where the value is used as a link and write some condition to get the value rather than let the click redirect.
If you just want the currently selected value then you need to find the same code, where it was processed as a link, and set a variable there that you can use for your purposes.

Related

set up form option as default in a drop down

I have created a driven database drop down menu on my website. It sends the selected value by the user to the database to be checked and returns a specific item.
Everything works perfectly now but I'm trying to pre select the first value so that the user will have the first option as default and can add it to cart directly and they also can choose a different size. So far, I tried 'selected' inside the option in the drop down but it doesn't do anything but displays the value when the page loads.
One last thing to mention, I'm using Ajax function to submit selected value and return result from the database.
I can think of two ways for this.
When the page is requested, make a call to your DB in your server-side code to store that value beforehand.
Use javascript's onload event to select the value as a part of a client-side script. You can use this answer as reference.

Webforms routing - populate hyperlink NavigateUrl with dynamic parameters

I'm using a linkbutton for this so I know that I can postback and perhaps redirect, however I'd prefer to do this directly using a hyperlink is possible.
I have a route setup with parameters:
href='<%$RouteUrl:RouteName=Apply, Amount=1234 %>'></a>
The issue I have is that I'm using jquery to update some textbox fields - so the user slides a slider, which updates a textbox. jQuery needn't be part of the equation because the user could also enter a value directly in the textbox.
What I want to achieve is that the amount param is dynamically inserted somehow into the the href value - almost like an embed block within an embed block. Is it possible?
Thanks in advance.

Selecting more than one value without checkboxes

Currenty I am using checkboxes to select more than one value in a form. So when creating a new post I can select all the categories it falls into. But the cat list is getting longer and is becoming a bit unmanagable.
I like how wordpress adds tags to each post via ajax. Wordpress has a text input field with autocomplete, you just start typing and then if it's already there (in the db) then it'll show and get adding to a list dynamically. If it's not found in the list then it gets inserted on form submit.
How can I achieve this or similar so that I don't have to use x amount of checkboxes?
Check out this jQuery library. It works on multi selects instead of checkboxes, but the logic and result is exactly what you need.
http://harvesthq.github.io/chosen/
(not affiliated, I've just used it a few times)
One option would be to make use a library such as jquery-autocomplete
https://www.devbridge.com/sourcery/components/jquery-autocomplete/
This makes use of AJAX based functionality and will give you the ability to tweak it based on values stored in a database table. You can make a simple check function that, in the case the value can not be found, the user will have the option to simply press add and insert it into said library.
The rest is jsut a matter of styling and design.

how to set value in noneditable editbox by using QTP

in my web application some of screen completely deal with Js framework we are doing Automation with QTP plz help me on below issue,
Visualy weblist box if I click in that Edit box will activiate but it's completely Readonly+Non Editable if we click Dropdown Icon it will populate one window in their Tree type value(Ex:Class>>Branch>>Section) we need click Section and then press Set Button then selected values populating in the Edit box.
even though if i'm making Editbox property Readonly is false after entering the values in the edit box clicking submit button it's giving error Null value in that Edit box ?all these are developers completely written in Javascript Framework so is there way to directly entering values with out selecting Popup window values by using QTP(VBSCRIPT) or Javascript code?
Thanks
I don't exactly understand your question but it seems to me that one of the options you're asking about is how to run JavaScript code from QTP. You can do this starting with QTP11 using Page.RunScript (or Frame.RunScript).

Javascript Disabled

i have a select dropdown list which has 4-5 fields. As soon as a user selects a value in the dropdown i have to assign a value to a hidden parameter on the page. (Using javascript function Onchange). The same hidden parameter is passed on to a hyperlink url whenever a user clicks on to it on a same page.
This works fine when javascript is enabled, but what to do when javascript is disabled ? i know there is noscript tag but how can i achieve above functionality ? can you give me some example code ?
Many Thanks,
There is nothing that will assign it to a hidden field if you have javascript disabled.
If javascript is disabled you will have to be able to handle the form posting to the server and figuring out on the serverside from the selected item in the form.
When javascript is disabled, then, javascript is disabled. Javascript is not there. So any solutions relying on javascript being there will not work.
If you want to support javascript disabled users also, then you must design the page sconsidering that.
In your case, you might want to use the value of the <option> in the <select> that is submitted when the form is submitted (no matter whether javascript is enabled or not)
The solution to my problem is that i created a url and then overwrite it using noscript tag. on click i was calling a javascript function which was again overwriting the same .
thus when javascript was enabled, onclick function was sending it to popup and when javascript was disabled the noscript tag was overwriting it and redirecting to a another page.

Categories