I would like to create a DTML Form that may be called with or without an argument (say, member_number). I have tried something like this, a DTML Form named AddAddressForm: <dtml-var standard_arfs_header> <dtml-form method=post action=AddAddress> <table> <dtml-unless member_number> <tr> <th>Member Number</th> <td><input type=text name=member_number></td> </tr> </dtml-unless> <tr> <th>Address</th> <th>City</th> </tr> <tr> <td><input type=text name=address type=string></td> <td><input type=text name=city type=string></td> </tr> <tr> <td colspan=2><input type=submit></td> </tr> </table> </dtml-form> My intent is to have a form that, if called with no input paramters, will display a field so I can enter the member_number. If the form is called with an input parameter, the member_number field will not be displayed, but the passed in value will be passed on to the AddAddress Method. The AddAddress method called by the form is a DTML Method which, in turn, calls a ZSQL Method to add the information to the database. The AddAddressForm will be called from another DTML Form. The line calling the above code looks like this: <a href="......./AddAddress?member_number=&dtml-member_number;">Add</a> The only way I can "see" the member_number in the AddAddressForm is to use <dtml-var member_number>. The shorthand _['member_number'] and &dtml-member_number; do not seem to work. Is this because of the namespace issues with the DTML Form? Am I trying to do too much here? I could make two forms, but I don't like the idea of maintaining two nearly identical forms. Can this be done? Thanks for your help. --greg
I would like to create a DTML Form that may be called with or without an argument (say, member_number). I have tried something like this, a DTML Form named AddAddressForm:
<dtml-var standard_arfs_header>
<dtml-form method=post action=AddAddress> <table> <dtml-unless member_number> <tr> <th>Member Number</th> <td><input type=text name=member_number></td> </tr> </dtml-unless> <tr> <th>Address</th> <th>City</th> </tr> <tr> <td><input type=text name=address type=string></td> <td><input type=text name=city type=string></td> </tr> <tr> <td colspan=2><input type=submit></td> </tr> </table> </dtml-form>
My intent is to have a form that, if called with no input paramters, will display a field so I can enter the member_number. If the form is called with an input parameter, the member_number field will not be displayed, but the passed in value will be passed on to the AddAddress Method.
...
Am I trying to do too much here? I could make two forms, but I don't like the idea of maintaining two nearly identical forms. Can this be done?
Try this... <dtml-form method="post" action="AddAddress"> <table> <dtml-if member_number> <input type="hidden" name="member_number" value="&dtml-member_number;" /> <dtml-else> <tr> <th>Member Number</th> <td><input type=text name=member_number></td> </tr> </dtml-if> <tr> <th>Address</th> <th>City</th> </tr> <tr> <td><input type=text name=address type=string></td> <td><input type=text name=city type=string></td> </tr> <tr> <td colspan=2><input type=submit></td> </tr> </table> </dtml-form> I haven't done DTML in a while, so you may need to fix my if/else. If the entity syntax won't work for you (and I don't know why it wouldn't), you can use the normal form. The hidden field trick is great for sequential pages. --jcc (better late than never)
participants (2)
-
Greg & Janet LINDSTROM -
J Cameron Cooper