I'm using rfid reader that the student will tap their id and after that it will display their basic info, i have a hidden button on my form, if click it will open a modal that contains several purposes that the student will choose,
Now my problem is on how to move the focus of the cursor the the button and automatic click it if the last text box has value.
Hope you can help me or give me an idea.
Probably better of firing a javascript function onclick and then either:
Using a function to send formdata via an AJAX function (See this page), or
Using javascript to change window.location
Related
I developed a page with only one button.
If a valid user appears i will allow that user to click that button
manually or user can also press enter(i will click that button using
js in background).
If a invalid user appears i will display a freeze layer on top of
that button, so that user cannot click that button.
Problem is if invalid user appears and press enter. my js code will click that button.
So, my question is straight forward is there any option in js to find whether user can click that button
I can also make alternate flow but i need to know answer for above question.
if(<user_is_not_valid_(your own condition)>){
document.getElementById("id_of_button").disabled = true;
}
This is for making a button unable to click. You should solve how to determine if the user is allowed to click. Put your own condition instead of < user_is_not_valid_(your own condition) >.
The user is valid or not is based on API request fire onpage load $.get in success you make the if (user.type==true){ $('#btn').addattr('onclick',funcname);}else{ ('#btn').attr('readonly',true);}
I'm using a form where in a text box is bound to a variable object by its path. I also have a button to fetch few records based on the input given in this text box. When I enter something for the first time and hit the button, it fetches the records. But again if I try to hit backspace or delete buttons inside the text box, it takes me to the previous page instead of simply deleting the text inside. Is there a way out? I tried with events like preventDefault() using keyCode restrictions, but in vain. Please help.
PS: This text box has regex validations and also has logic to pre-populate.
when records are fetched, you lose the focus on your text box. When you press the Backspace key once more, the browser takes you to the previous page (as most browers do). Set the focus back on your element after you fetch the records or change you code so the records fetching will not change the focused element.
See : https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement.focus
I have a simple Lotus Notes XPage with only an editable RichText dialog that is embedded in a bigger form using an iframe.
The bigger form has a submit button, which triggers some javascript and finally a notes agent which saves all non-richtext values that are inside the bigger form.
Of course the user shall not have to use two submit buttons, so I won't have a (visible) submit button for the XPage. Instead, I want to use javascript to tell the iframe to submit the form.
Using iframe.document.forms[0].submit() does not work - the form is indeed submitted to the Notes server, but XPages won't save the changes I made.
Using a simple XPage button with the action "Save Data Sources", saving works like a charm, but I don't want the user to have to click two buttons in the correct order.
I also tried the following javascript code to fill some invisible fields with the values that IBM submits to the server, but this does not help either:
iframe.document.forms[0].elements["view:_id1:inputRichText1_h"].value = iframe.document.forms[0].elements["view:_id1:inputRichText1"].value;
iframe.document.forms[0].elements["view:_id1:inputRichText1_mod"].value = true;
iframe.document.forms[0].elements["$$xspsubmitid"].value="view:_id1:_id4";
iframe.document.forms[0].elements["$$xspsubmitscroll"].value="0|0";
iframe.document.forms[0].submit();
So now I ask you: how to correctly submit that form content, without the user actually clicking the XPages button? Can I programmatically trigger a click on that button, which would be indifferent from a human actually clicking, except for the human?
have an ordinary div with a fixed id and inside this div have a computedtext that will compute the clientsideid of the "save button" and return that inside the div
and use this clientside js code to do the actual click
var id=iframe.document.getElementById("button").innerHTML
var button=iframe.document.getElementById(id)
button.click()
I have a form that uses the selected item in a drop down, and is supposed to go to a specific ur in the button click event... Here is what I'm looking for..
Button on click event is
www.something.com/something=$variable
Where $variable is what the user selects in the drop down list.
I can't just use the simple get method because I have other buttons on the form that open a specific window as well, but with PERL variables.
Can anyone tell me how to take the value in the Drop down list and insert it into the end of that url I provided? Any guidance would be helpful.
How can I (if at all) load a new page when an html's selector changes if javascript is disabled in the browser.
Can it be done?
I guess you mean the html select box having some page titles displayed and as soon as the user selects one of them the new page showes up.
This is not possible with out javascript - the only thing you could do is to add a submit button.
<noscript><input type="submit" value="go!"></noscript>
This button would only be displayed if javascript is not activated.
No, you cannot reload a page when a select box changes (if that's your question) without using a scripting language or similar.
Without a scripting language (that would be JavaScript if you want to be cross-browser), most form elements are "dumb", they hold their state and display user feedback.
So if you want to select a new page after selecting it in a form (combo box, list, radio buttons...), you have to add a submit button to send the choice to a server, and have a server side script handling the choice and serving the right page.
The good old Web 1.0 way... :-)
You can't. With HTML only, changing the selected option makes the value of that option to be sent to the server upon submit (either via the Enter key or a submit/button element). You can eventually set up the receiving script to send back a HTTP Redirect based according to the selected option.
You shouldn't. This kind of navigation widget implies the use of a mouse: somebody using the keyboard to navigate the page cannot even select the second option at all (as soon as the down arrow is pressed once the onchange() event activates). Do the right thing and add a submit button, with the page change activated by the onsubmit() event.