Link to home
Start Free TrialLog in
Avatar of fskilnik
fskilnikFlag for Brazil

asked on

extracting from a string - Classic ASP

Hi there,

My form has the structure shown below:
---------------------------------------------------------------------------------------------------------------------------
<form id="form1" name="form1" method="POST" action="../../Codes_my/confirmScheduling.asp">
      <table class="table table-striped">
                    <tr>
                      <th>Day/Time</th>
                      <th>Mo </th>
                      <th>Tue </th>
                      <th>Wed </th>
                      <th>Thu </th>
                      <th>Fri </th>
                      <th>Sat </th>
                    </tr>
                     <tr>
                      <th>7h30min - 8h20min</th>
                      <td><% If ... Then %>
                      <input name="hiddHorarioID" type="hidden" id="hiddHorario47" value="475_<%= ThisDay(4)%>" size="5" />
                      <button class="btn btn-primary btn-sm" type="submit">five credits</button>
                      <% Else %>
                  <% If ... Then %>
                        <button class="btn btn-info btn-xs disabled" type="submit">reserved</button>
                  <% Else %>      
                       <button class="btn btn-primary btn-xs disabled" type="submit">reserved</button>
                 <% End If %>
                 <% End If %>
                 </td>
                      <td><% If ...  Then %>
                      <input name="hiddHorarioID" type="hidden" id="hiddHorario57" value="575_<%= ThisDay(5)%>" size="5" />
                       <button class="btn btn-primary btn-sm" type="submit">five credits</button>
                      <% Else %>
                     <% If ... Then %>
                              ...       
                            <% Else %>      
                              ...      
                     <% End If %>
                        <% End If %>
                 </td>
                      etc
                    </tr></table>
</form>
------------------------------------------------------------------------------------------------------------------------------

The problem is that when the user clicks one of the buttons, the string "carried" by the string variable "texto"

texto = CStr(Request.Form("hiddHorarioID"))

present in the confirmScheduling.asp  is something like that:

texto = 415_7/20/2017, 515_7/21/2017, 225_7/18/2017, 325_7/19/2017, 425_7/20/2017, 727_7/23/2017, 235_7/18/2017, 435_7/20/2017, 145_7/17/2017, 245_7/18/2017, 345_7/19/2017, 445_7/20/2017, 545_7/21/2017, 155_7/17/2017, 255_7/18/2017, 355_7/19/2017, 455_7/20/2017, 165_7/17/2017, 265_7/18/2017, 365_7/19/2017, 175_7/17/2017

because it captures ALL "radio buttons"  presented in the form, not only the one related to the button the user clicked.

How should I correct that, please?

Thanks a lot,
fskilnik.
SOLUTION
Avatar of Shaun Kline
Shaun Kline
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of fskilnik

ASKER

Hi, there!

First of all, thank you both for your time and expertise.

@Shaun ::  I understand what you mean and, to be honest, I have already done that before, so it would not be hard for me to review my own code and do the same here.  It is really a good idea to solve the problem, by the way.

@MlandaT :: great, this solves the problem (I tested it) and, important to mention, "corrects" my initial idea, as I have asked originally.

For other potential interested people and also for me, for future reference, I modified my code leaving exactly just this (I mean, substituing each "pair" input/button) :

<button class="btn btn-primary btn-sm" type="submit" name="hiddHorarioID" id="hiddHorario11"  value="115_<%= ThisDay(1)%>">115_<%= ThisDay(1)%></button>


Thank you very much both of you. I hope to be fair in my judgement and splitting points...

Regards and see you in my next difficulties!   :)
Fábio.