Jump to content

Submit by selecting a textbox


RobD

Recommended Posts

What you can do is

<form action="xx" method="xx" name="w3c"><other form stuff/><input type="submit" name="iSub" /></form>

and in the JS write

document.w3c.iSub.clicked;

I hope this works!

Link to comment
Share on other sites

Hi all,First of all I am not an expert in developing html but I am getting (a little bit) wiser every day. I created a screen (frontpage/plain html) wich displays customer codes. When I select (double click) a customer code (using Firefox 2.0) it will be copied to the top code. This works fine when I use onselect at all textboxes:onselect="document.getElementById('code').value=document.getElementById('code1').value"onselect="document.getElementById('code').value=document.getElementById('code2').value"onselect="document.getElementById('code').value=document.getElementById('code3').value"etc.Now I want to submit the form at the moment the code is copied and I tried this:onselect="document.getElementById('code').value=document.getElementById('code3').value;document.myform.submit();return true;">The code is still copied but the submit wont work. How can I submit a form (after copy the text into another textbox) by only selecting a textbox? So I do not want to do any extra click on a submit button.I hope someone can help me. Thank you in advance!Rob

Link to comment
Share on other sites

Hi Prateek,thank you very much for your reply. I tried to do what you said but it doesn't work in the onselect:onselect="document.getElementById('code').value=document.getElementById('code3').value;document.myform.isub.clicked;">I guess I miss a lot of expertise here.Could you please give me an example how to set this up in the onselect?Kind regardsRob

Link to comment
Share on other sites

try document.myform.isub.clicked=true;

Link to comment
Share on other sites

Hi all, thank you again for all your response.I tried what you all suggested but somehow it won´t work.<FORM METHOD="POST" ACTION= "xhlvz" name="myform" id="myform"><input type="text" name="code" id="code"><input type="text" name="code1" id="code1" onselect="document.getElementById('code').value=document.getElementById('code1').value;document.myform.iSub.clicked;"><input type="text" name="code2" id="code2" onselect="document.getElementById('code').value=document.getElementById('code2').value;document.myform.iSub.clicked=true;"><input type="text" name="code3" id="code3" onselect="document.getElementById('code').value=document.getElementById('code3').value;document.myform.submit();"><input type=”submit” name =”iSub” />Maybe I did something wrong or I didn´t understand. Maybe my code is wrong. I hope you can help me out.Kind regardsRob

Link to comment
Share on other sites

Hi all,I found the problem. I defined a button with the name="submit", so the document.myform.submit() reffered to the input button named submit. I changed the name and now it works fine.Again, thank you all for your response!Kind regardsRob

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...