The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
|
Updating datagrid through radio button selection
Posted: 02 Jan 07 5:16 PM
|
fiogf49gjkf0d Does anyone know how I can repopulate the datagrid on the page when the user selects a different option via a radio button? Also, I want to be able to click on a record on the datagrid and populate some readonly textboxes on the page. |
|
|
|
Re: Updating datagrid through radio button selection
Posted: 03 Jan 07 2:21 AM
|
fiogf49gjkf0d For the radio button part, two ways you could go firstly you could have a frameset, and have an onchange event on the radio button that would reload the query on the bottom frame (you can copy functionality from the advanced lookup for example), or you could have the radio buttons as part of a from and have the onchange of the radio button submit the form, record which button they clicked in a database field and use this to filter the query by (the submit of your form will refresh the page, and query).
For the onclick add an event to the query ONROWSELECT and any javascript function you want to call i.e. "rowSelected()". Have a function rowSelected
function rowSelected() { selectedRow = event.rowIndex; }
You can get the id of the row with similar to the following:
document.all.queryname.rows(selectedRow).getElementsByTagName('SPAN')(0).id
You will have to set the ID property of the query to be the queryname stated above. You can either call another function from rowSelected to populate your textboxes or do it directly in the rowSelected function... |
|
|
|
Re: Updating datagrid through radio button selection
Posted: 03 Jan 07 11:53 AM
|
fiogf49gjkf0d Thank you for your reply, I don't suppose that it's possible to access the posted results through Javascript or use an action to access the html and reassign values to the form? |
|
|
| |
|
Re: Updating datagrid through radio button selection
Posted: 03 Jan 07 2:16 PM
|
fiogf49gjkf0d What it is I want to do is - click a radio button and have it postback to the page so all the information in the form, I won't loose. So, I wanted to build a javascript to reassign the values on the form to what they were before the postback.
Also, var posted = '<#AF name=postedvalue>'; - what is the value that I should put in place of the postedvalue you have defined in the javascript? |
|
|
|
Re: Updating datagrid through radio button selection
Posted: 03 Jan 07 3:45 PM
|
fiogf49gjkf0d ok you could set a hidden form element to a value then on the init of the page check the #af name=hiddenvar to populate the required element ie select the radio button... |
|
|
|
Re: Updating datagrid through radio button selection
Posted: 03 Jan 07 4:18 PM
|
fiogf49gjkf0d Here's what I have so far. When you pick a radio button, it redirects to itself after setting a hidden field to the currently selected radio button - here's the js for that:
function RefreshGrid(form) { var Count = 0; for (Count = 0; Count < 3; Count++) { if (form.rWorkslips[Count].checked) { form.txtSelectedWorkslip.value = form.rWorkslips[Count].value; form.txtIsPostBack.value = "true" form.submit(); } } }
Then onload I check the hidden field to see if anything is in it, if so - I'm going to do something, if not, I do something else - right now I have an alert on each for testing. Everytime I run it, it never has anything inside of my hidden field. What am I doing wrong? Here is that js.
function PopulatesForm() { var posted = '<#AF name=txtIsPostBack>'; alert(posted); if (posted.length > 0) { alert("This is a PostBack"); } else { alert("No PostBack"); } } |
|
|
|
Re: Updating datagrid through radio button selection
Posted: 03 Jan 07 4:39 PM
|
fiogf49gjkf0d I haven't got a web client handy to test a you could try doing a sessionstartand pick up the #sf nameispostback. if not maybe try appending your variable to the end of the form action? perhaps the #af doesn't like retrieving values from a previously posted form |
|
|
| |
|
Re: Updating datagrid through radio button selection
Posted: 04 Jan 07 2:22 AM
|
fiogf49gjkf0d <#SYS name=swcpath>/sessionstart?nextpage=yourtemplatename
then to access your form variables you use #sf instead of #af.
Just as a check is the alert happening and showing nothing? Just checking that function is definately being called.
You can email me and send me all the code if you would like me to take a look? |
|
|
|
Re: Updating datagrid through radio button selection
Posted: 05 Jan 07 8:41 AM
|
fiogf49gjkf0d Corey:
I just got thru the thread and I am not sure what your intentions are on your last post, but based on what you were describing as needing to do on the original post, why would you post the form?
Wouldn't it be rather simpler to handle it all AJAX style using the xmlHTTP object to retreive data based on user selection and change the Grid using DHTML all within the Java Script?
Again, I am not sure what your requirements are, but you would be avoiding having to repost the page every time the user makes a selection. |
|
|
|