Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

to show radio options and submit button on selection... 1

Status
Not open for further replies.

nelco

Programmer
Apr 4, 2006
93
US
I have an asp page where I have two radio buttons and next to each button there is a list box with default selection so that user can sort by as per the selection.
I also have reset and submit button.

My page works well. Now the user says that I do not like the List box and also do not want to see submit button unless I select the radio option.

User wants me to create in such a way that once user selects the radio button, it should refresh page and show four new radio buttons down on the page which has the same option as in list box and also show submit button.
The user will now select the sort by option from here.

I have never done this kind before. Any suggestions or help will be appreciated.

My code now looks like:

<%@ LANGUAGE="VBScript" %>
<!--#include virtual="/common/DSFRemoteUI/DSF_RemoteUI_inc.asp" -->

<html>

<div align="right"><a href="LPM_Default.asp">back to Real Estate System Main page </a></div>
<h3 align="center">Real Estate Payment Reports </h3>
<form name="RE_Report" method="post" action="LPM_Report_Common.asp" target = "_blank" >

<table width="98%" border="1" align="center" >

<tr>
<td>
<input name="re" type="radio" value="TimeLine02187.rpt">
Generate Real Estate Service Payment Report </td>
<td><select name="select1">
<option value="costCenter" selected>group by cost center</option>
<option value="serviceType">group by service type</option>
<option value="vendorName">group by vendor Name</option>
<option value="vendorNumber">group by vendor Number</option>
</select></td>
</tr>
<tr>
<td><input name="re" type="radio" value="TimeLine02187.rpt">Generate Real Estate Rent Payment Report </td>
<td><select name="select2">
<option value="costCenter" selected>sort by cost center</option>
<option value="vendorNumber">sort by vendor number</option>
<option value="vendorName">sort by vendor name</option>
<option value="leaseTodate">sort by lease to date</option>

</select></td>
</tr></table>

<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p align="center">
<input type="reset" name="Reset" value="Reset">
<input type="submit" name="Submit" value="Submit">
</p>
<p>&nbsp;</p>
</form>

</html>

The user does not want list box and submit button. Only when he selects radio option then it should show another 4 radio options as shown in the list box and also submit button. This can be done only one refreshes the page. Any help will be appreciated.
Thanks, Nelco
 
this is more javascript. but I may be able to point you enough here to get started. Javascript forum can help you make it look pretty (I am no JS guy).

Have the form's action be itself or just pound sign (#), in the Header you put - and alter the destination_page.asp to yours.

Code:
<SCRIPT LANGAUAGE=javaScript> 
//this function just submits to same page for dropdown. 
    function submitMe(){
        document.RE_Report.submit();
    }
</SCRIPT>
<SCRIPT Language="JavaScript">
// this function is for the actual form submital.
function goNextPage(sel)
{
// don't process this if no valid selection...
	if ( sel.selectedIndex == 0 ) return;
	// okay...go on to next page!
	sel.form.action = "destination_page.asp";
	sel.form.submit();
}
</SCRIPT>

On the form element you just call this.


Code:
 onChange="submitMe();"

kind of like this for a select box

Code:
<select name="txtCategory" class="inputbox" id="txtCategory" onChange="submitMe();">

You could just put onClick instead of onChange for the radio buttons (or maybe onBlur).

Now you say you do not want a submit button to show - but before that - change your regular submit button to be a button like this.

Code:
<input type="button" name="Submit" value="Add Product Item" onClick="goNextPage(this)">

That will make the button act like a submit button and go where the javascript is at.

To hide stuff, you can do all sorts of things - like look for say a form value - querystring or not - if nothing then set an arbitrary value of zero

and if that value = zero than do not show, otherwise show.

Make sense?




Stuart
 
Thanks for the suggestion. I used the concept. It took some time but finally I got what user was expecting.
Once again thanks for all the work and help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top